2. Algorithms and first program in C

 #Some important:


*/……*/. – It is not considered a program. 


#include<stdio.h> – Header file used


main(){    – it is a beginning for program



printf – it is  function used to input

scanf – it is function  used to  output


Input : input means to provide a program with some data to be used in the program.


Output : output means to display data on screen or writer the data to a printer or a file .


& it is a Address operator 


return 0  end of the program



Compiler 

int 

float 

double 

char

16-bit

2 byte

2

4

1

32 -bit

4 byte

4

8

1

64-bit

8 byte

8

16

1



Note:- ASCII  value of upper case : 65 to 90

  ASCII value of lower case : 97 to 122



Arithmetic instruction : 


Multiplication 

*

Subtraction 

-

Addition 

Division 

/

Modulus 

%

Assignment 

=





ALGORITHMS : 


Step by step solution of a given problem written in an ordinary language like English.


 Algorithm : To find addition of two numbers 

 Input         : two numbers a and b

 Output      : addition of two numbers a and b



  • Step 1 − START.

  • Step 2 − input a and b

  • Step 3 − define values of a & b.

  • Step 4 − add values of a & b.

  • Step 5 − store output of step 4 to c.

  • Step 6 − print c.

  • Step 7 − STOP




FIRST C PROGRAM :



#include<stdio.h>


int main() {


    printf("Hello world");


    return 0;

}

OUTPUT:
Hello world

Post a Comment

Previous Post Next Post