state the use of %d and %f and wro the printf statement of 'C' using above mentioned symbol
Answers
Answer:
%d & %f are the format specifiers for the printf statement
%d is for integers and %f is for floating point number
Example:
printf("%d\n%f\n", 10, 10.23);
Explanation:
I know you are in a hurry because of a exam but no problem
Answer:
%d and %f are format specifier used to access or display integer data types
and float data types respectively using variable in printf and scanf statements
in c programming.
General syntax of %d :
Use of %d to declare and access the integer data types.
Example:
scanf(“%d”,&num1);
General syntax of %f :
Use of %f to declare and access the float data types.
Example:
scanf(“%f”,&percent);
example of printf statements using %d and % f:
printf(“the marks of subject 1 are: %d”,num1);
printf(“the percentage of student is : %f”, percent);