Welcome !!

NICETECHVIDYA

Tutorials

Web Designs

You are welcome to Aptech Designers, designed by Pratik from Nepal.

Creativity is my passion. Logo describes your details about company.

Graphics Design needs vision to create yours unique digital concept.

Responsive and All Browser Compatible Dynamic Web Layouts our target.

Home Python C Language J A V A Our Courses
This WebSite is under Construction....

Thursday 10 March 2022

11.Differences

 

Differences:

Variables used in a program must be declared before using them

Every C statement must be terminated with a semicolon (;)

A C program must be placed within the structure that is the main( ) function.

 

Need of accepting data from the console input device (Keyboard)

 


 

 

 

 

 

The above program adds only two numbers that is 45 and 50. If we want to add any other numbers then, the program must be modified. Say for example we want to add 125 and 256 then; the program must be modified as.

 

 

 

 

 

 

 

 

We need to modify the program every time need to add two different numbers.

 

Need of scanf( ):

 

It is not a good practice to change the program, whenever input to the program need to change.

Scanf( ) is a function used to accept the data from the user while executing the program.

Different inputs can be given for different executions without changing the program.

The scanf accepts the data from the user and stores into the specified variables

In scanf the representation characters and the addresses of variables must be specified.

Syntax:

scanf(“<representation characters>”,list of addresses of variables);

 
 

 

 

 


Example:

 

 

 

 

 

 

 

 

 

 

 

 


Example explained:

During the run-time scanf( ) prompts and accepts the number from user and stores into the variable x

 

 

 

 

Example:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


            

 

 

0 comments:

Post a Comment