Wednesday, February 16, 2011

Managing Input and Output Operations

The program presented illustrates the testing for correctness of reading of data by scanf function.
#include <stdio.h>
void main()
{

int a;
float b;
char c;
printf("Enter values of a, b and c\n");
if (scanf("%d %f %c", &a, &b, &c) == 3)
printf("a = %d b = %f c = %c\n" , a, b, c);
else
printf("Error in input.\n");
getch();
}






No comments:

Post a Comment