Computer Science, asked by soumyasitak3474, 1 year ago

Proram to declare some variable of type int float double assogn somevalue to variable

Answers

Answered by tejasgupta
5

Heya !!

Assuming that your question is related to C++ , I'll answer your question. Before starting with the program, Let's discuss some terms....

  • Int Data Type: This data type is used to store numerical data that is either negative, positive, or zero. It can not store decimal values. For example: 100, -230, 0 etc....
  • Float Data Type: This data type is used to store decimal values. For example: 2.33, 3.55, 2.68 etc....
  • Double Data Type: This data type can store decimal values accurately.

Now, let's start with the program:

~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~

#include iostream.h

using namespace std;

int main() {

int x = 300;

float y = 22.46;

double z = 3453.5635257464;

cout<<"This is an example of int"<<x<<endl;

cout<<"This is an example of float"<<y<<endl;

cout<<"This is an example of double"<<z<<endl;

}

~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~-~_~

Hope it helps !!


tejasgupta: No. I'm in class 9.
Similar questions