VARIABLES
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:
0 Comments