C Program to Demonstrate Various Datatype

Write C Program to Demonstrate Various Datatypes

#include<stdio.h>

int main()
{
	signed int n1;
	int n2;
	float n3;
	char n4;
	double n5;
	long double n6;
	long int n7;


	printf("Enter the signed integer :--> ");
	scanf("%i", &n1);

	printf("Enter the integer :--> ");
	scanf("%d", &n2);

	printf("Enter the long integer :--> ");
	scanf("%ld", &n3);

	printf("Enter the character :--> ");
	scanf(" %c", &n4);

	printf("Enter the floating number :--> ");
	scanf("%f", &n5);

	printf("Enter the double number :--> ");
	scanf("%lf", &n6);

	printf("Enter the long double number :--> ");
	scanf("%Lf",&n7);



	printf("\n\nOutput of the different data types :");
	printf("\n\nThe signed integer number is :--> %i",n1);;
	printf("\nThe integer number is :--> %d",n2);
	printf("\nThe long integer number is :--> %ld",n3);
	printf("\nThe character is :--> %c",n4);
	printf("\nThe floating number is :--> %f",n5);
	printf("\nThe double number is :--> %lf",n6);
	printf("\nThe long double number is :--> %Lf",n7);

	return 0;
}

Output:

Enter the signed integer :--> 45
Enter the integer :--> 123
Enter the long integer :--> 76543
Enter the character :--> g
Enter the floating number :--> 56.56
Enter the double number :--> 56789.78
Enter the long double number :--> 987654.764

Output of the different data types :-->
The signed integer number is :--> 45
The integer number is :--> 123
The long integer number is :--> 76543
The character is :--> g
The floating number is :--> 56.56
The double number is :--> 56789.78
The long double number is :--> 987654.764

<< Previous | Next >>


Leave a Reply

Your email address will not be published.