1 (B) Write a program to declare some variables of type int, float and double. Assign some values to these variables and display these values.

1 (B) Write a program to declare some variables of type int, float and double. Assign some values to these variables and display these values. 

Write a program to declare some variables of type int, float and double. Assign some values to these variables and display these values.


#include <stdio.h>
int main(void)
{
int sum;
float money;
char letter;
double pi;
sum = 10; /* assign integer value */
money = 2.21; /* assign float value */
letter = ‘A’; /* assign a character value */
pi = 2.01E+6; /* assign a double value */
printf(“ value of sum = %d\n”, sum);
printf(“ value of money = %f\n”, money);
printf(“ value of letter = %c\n”, letter);
printf(“ value of double = %e\n”, pi);
return 0;
}
1 (B) Write a program to declare some variables of type int, float and double. Assign some values to these variables and display these values. 1 (B) Write a program to declare some variables of type int, float and double. Assign some values to these variables and display these values. Reviewed by admin on December 22, 2019 Rating: 5

No comments:

Powered by Blogger.