Study of variables and scanf function.

#include <stdio.h>

int main(void)
{
/* Variable declaration statements */
int i;
float f;
char ch;

/* Ask the user to enter values for the variables */
printf("\nEnter an integer value : ");
scanf("%d", &i);

printf("\nEnter a floating point value : ");
scanf( "%f", &f );

printf("\nEnter a character value : ");
fflush(stdin);
scanf("%c", &ch);

/* Display variable values */
printf("\nInteger = %d\nFloat = %f\nCharacter = %c", i, f, ch);

return 0;

}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin