0
Input & output methods
Is scanf() is used to take input from user of type integer only or any other data type also...?
4 Answers
0
You can use a format specifier for what data type of input you want from the user.e.g if you want an int input from the user then,
int x;
scanf("%d", &x);
here we %d format specifier because we want int input from user.
+ 3
Yes its also use for other data type ,
Like in integer input
int a;
scanf("%d",&a);
For float
float a;
scanf("%f",&a);
So you see the changes only specifier is change .
specifier is :
int :d&i
float:f
char:c
string:s
long int:ld
+ 1
Maninder $ingh ThankYou, Understood now đ
0
Prathvi ThankYou đ