(s.p) Unit-1 BASICS OF C PROGRAMMING

UNIT-1

OVERVIEW OF C PROGRAMMING 



  • COMPONENTS OF COMPUTER :

In the computers input is given with help of input device like keyboards and mouse, based on a instruction cpu performance the processing and display the output on the output screen with the help of the output device.

Algorithm :

An Algorithm using finite set of unambiguous instruction which can be executed perform and task correctly.

There are three characteristics of an algorithm they are as follow :

  1. The number of steps required to perform task should be finite.
  2. Which instructions should be unambiguous nature. meaning the output  should be definite and predictable.
  3. Finally the algorithm should solve the problem correctly.
Question-1 Develop an algorithm to find sum of 3 numbers and take input from user.

  1. Start
  2. Input First number in A.
  3. Input Second number in B.
  4. Input Third number in C.
  5. Compute Sum = A+B+C
  6. Display Sum.
  7. End

Question-2 Develop an algorithm to find area of rectangle.

  1. Start Input 
  2. Length in A. 
  3. Input Breath number in B. 
  4. Compute Area = A.B 
  5. Display area. 
  6. End

Question-3 Develop an algorithm to find average of three numbers

  1. Start
  2. Input First number in A.
  3. Input Second number in B.
  4. Compute Average = (A+B+C)/3
  5. Display Average.
  6. End

Question-4 Develop an algorithm to find maximum of two numbers Entered by user .

  1. Start
  2. Input First number in A.
  3. Input Second number in B.
  4. if(A>B), then
            max = A
            Else, max = B
  5.Display max.
  6.End.

Question-5 Develop an algorithm to find whether number entered by user is odd or even.

  1. Start
  2. Input First number in A.
  3. if a%2 == 0, then
        Display A is even, else
        Display A is  odd
     4.End

  • Flowcharts

  Graphical representation of flow of program is known as flowchart

The flowchart helps us graphically visualize the flow of program.
The flowchart uses some standard notations to graphically represent the logic.

Develop a flowchart to find sum of three numbers

Develop a flowchart to find maximum of two number








Post a Comment

Previous Post Next Post