TYPES OF VARIABLES:

  • int - it will store integers in  range = 123 or -123
  • double - it will  store  floating point numbers, with decimals in range= 19.99 or -19.99
  • char - it will store single characters, such as 'a' or 'B'. 
  • string - it will store text, such as "Hello World". 
  • bool - use for cheack condition & store as: true or false

SYNTAX:
      type variable = value;

TYPES OF OPEATOR:
  • Arithmetic Operators[+,-,*,/]
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment Operators
Here we are using arithmetic operators.

 FIND THE AVG & SUM
 CODE:
#include<iostream>
using namespace std;
int main()
{
int c,a,b;//variables with type int
float d;//variable  with type float
cout<<"program of sum & avg"<<endl;
cout<<"enter the 2 number";
cin>>a>>b;
c=a+b;
d=a+b/2;
cout<<a<<"+"<<b<<"="<<c<<endl;
cout<<"avg"<<"="<<d<<endl;
return 0;
}
    OUTPUT:





2]COVERSION FROM CM TO METER INCHS &FEET”
  
CODE:
#include<iostream>
using namespace std;
int main()
{
float a,b,c,d;
cout<<"program of converssion"<<endl;
cout<<"enter the value in cm";
cin>>a;
b=a*0.01;
c=a*0.0328;
d=a*0.393;
cout<<"in meter"<<b<<"in feet"<<c<<"in inch"<<d;
}
OUTPUT:




0 Comments