DATA INPUT / OuTPUT
When we make a program, we need to get some
data from user and display some data to user. Since data is of various types
like a Real Number, Integer Number, Characters or String. Thus there are
various syntax to get various data from user and to display data.
Here are the One Line Syntax to input and display data:
1-
Integer :
Input: scanf(“%d”,&a);
Output: printf(“%d”,a);
2-
Float :
Input: scanf(“%f”,&b);
Output: printf(“%f”,b);
3-
Character:
Input: scanf(“%c”,&c);
Output: printf(“%c”,c);
4-
String:
Input: scanf(“%s”,st); OR
gets(st)
Output: printf(“%s”,st); OR
puts(st)
5-
Long Double
Input: scanf(“%ld”,&xx);
Output: printf(“%ld”,xx);
6-
Long Float:
Input: scanf(“%lf”,&yy);
Output: printf(“%lf”,yy);
Good blog👍👍
ReplyDelete