Things to note: 1.The first printf( ) function outputs the message on screen. Using expressions in printf( ) is optional. 2.scanf( ) receives input from keyboard, it is a built-in function. The ampersand (&) before the variables in the scanf( ) function is must. & is an 'Address of ' operator, it gives the location number used by variable in memory. When we say &a, we are telling scanf( ) at which memory location should it store the value supplied by the user from the keyboard. 3. A blank, a tab or a new line must separate the values supplied to scanf( ) 4.If a integer value is passed, %f in the scanf( ) function converts and stores the given integer value as a float. Powered by
|