SEMrush

Thursday, 7 April 2016

C Basic Functions scanf function


                             scanf() function in C

          scanf() in C is used to read a value in to a variable.In the case of constants we can assign the value directly ,
   
             eg: int a=10;
                
                  string c="ammu";
      if we want to change the value of one variable many times as we wish,we need to use the scanf() function.

            eg:we need to add 10 numbers  one after another
              
                  we use
                                 for( i=0;i<9;i++)
                                      {
                                    
                                                    scanf("%d",&k); 
                                                      sum=sum+k;
                                     } 



No comments:

Post a Comment