#include <stdio.h>
int main()
{
int a=5;
float b=50.34;
char ch=’C’;
double d=2345346.765;
printf(“\n value of a=%d”,a);
printf(“\n Value of b=%.2f”,b);
printf(“\n Value of Ch=%c”,ch);
printf(“\n value of d=%lf”,d);
printf("\nSize occupied by int data type: %lu bytes ", sizeof(int));
printf("\nSize occupied by float data type: %lu bytes ", sizeof(float));
printf("\nSize occupied by character data type is : %lu byte ", sizeof(char));
printf("\nSize occupied by double data type: %lu bytes ", sizeof(double));
return 0;
}
Output:
value of a=5
Value of b=50.34
Value of Ch=C
value of d=2345346.765
Size occupied by int data type: 4 bytes
Size occupied by float data type: 4 bytes
Size occupied by character data type is: 1 byte
Size occupied by double data type: 8 bytes
Explanation:
In the program first we have include the standard input output header file named
The variables int, float, char, double are declared and initialized inside the main function.
The program shows all values of int, char, float and double variables on console ouput.
The e sizeof() operator is used to to decide the size of various data types in bytes.
The program given above displays the size of int, float, char and double data types using the printf() function with the suitable format specifiers.
The output will show the size of respectively data type in bytes, as well as how much memory each data type occupies on the system.
1.Write a program in C to find area of circle using single-line comments.
2.Write a C program to find addition of two numbers with multi-line comments to write down the purpose of every steps.
3.Write a program in C that describe a complex mathematical formula with nested comments.
4.Write a C program to demonstrate the declaration and initialization of variables of different data types.
5.write a program code in c to swap a values of the two variable without using a third variable.
6.Write a program in c to find area of rectangle by accepting variable value length and width.
7.Write a program that accepts user input for employee name and salary, and then display them using those variables.
9.Write a program in C to convert temperature from Celsius to Fahrenheit using proper data types.
10.Write a C program to achieve basic arithmetic operations on any two numbers of various data types.
11.Write a program in C that accepts any two numbers from user and calculate addition, multiplication, subtraction and division (+, *,-, /) and show the result.
12.Write a program in c input user name, age And display it.
13.Write a program in C that asks the user to enter the marks obtained in three subjects. Read the marks using scan. Calculate the average marks and display the student details.
Other Topic:-->>Dynamic memory FAQ. || Operators Assignments in C.