C++ Program To Demonstrate Various Datatype

Write C++ Program to Demonstrate Various Datatypes

#include <iostream>

using namespace std;

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

     cout << "Enter the signed integer :--> " ;
     cin >> n1 ;

     cout << "Enter the integer :--> " ;
     cin >> n2 ;

     cout << "Enter the long integer :--> " ;
     cin >> n3 ;

     cout << "Enter the character :--> " ;
     cin >> n4 ;

     cout << "Enter the floating number :--> " ;
     cin >> n5 ;

     cout << "Enter the double number :--> " ;
     cin >> n6 ;

     cout << "Enter the long double number :--> " ;
     cin >> n7 ;

     cout << "\n\nOutput of the different data types :" ;
     cout << "\n\nThe signed integer number is :--> "<< n1 ;
     cout << "\nThe integer number is :--> " << n2 ;
     cout << "\nThe long integer number is :--> "<< n3 ;
     cout << "\nThe character is :--> " << n4 ;
     cout << "\nThe floating number is :--> " << n5 ;
     cout << "\nThe double number is :-->"<< n6 ;
     cout << "\nThe long double number is :--> " << n7 ;

    return 0;
}

Output:

Enter the signed integer :--> 55
Enter the integer :--> 3456
Enter the long integer :--> 98765
Enter the character :--> G
Enter the floating number :--> 66.77
Enter the double number :--> 987654.765
Enter the long double number :--> 9876543.654

Output of the different data types :
The signed integer number is :--> 55
The integer number is :--> 3456
The long integer number is :--> 98765
The character is :--> G
The floating number is :--> 66.77
The double number is :-->987655
The long double number is :--> 9876543

<< Previous | Next >>


Leave a Reply

Your email address will not be published.