Professional Documents
Culture Documents
Dev C ++ Language
Q1- Define increment (+ +) and decrement Operator ( ̶ ̶ )
Increment Operator:
The increment operator can be used with any type of variable.
It is used to add 1 to the value of a variable.
It is represented by + + (double plus sign).
It is used in two ways;
They can be uses into ways.
1. (+ + variable name; i.e. + + a;) first increase by one than further process. This type is called
“Prefix” operator.
2. (variable name ++; i.e. a + +;) first process than increase by one. This type is called “Postfix”
operator.
Decrement Operator:
The increment operator can be used with any type of variable.
It is used to subtract 1 from the value of a variable.
It is represented by ̶̶ ̶̶ (double minus sign).
It is used in two ways;
They can be uses into ways.
1. ( ̶̶ ̶̶ variable name ; i.e . ̶̶ ̶̶ a;) first decrease by one than further process. This type is called “Prefix”
operator.
2. (variable name ̶̶ ̶̶ ; i.e. a ̶̶ ̶̶ ;) first process than decrease by one. This type is called “Postfix”
operator.
Start
Declare Variable
Float length, width & area
Read
length, width
Write
area
Stop
Source Code:-
#include <iostream>
using namespace std;
int main ()
{
float length, width, area;
cout<<"\n \t \t Area of Rectangle";
cout<<"\n \t \t *****************";
cout<<"\n \t Enter Length \t";
cin>>length;
cout<<"\n \t Enter Width \t";
cin>>width;
area=length*width;
cout<<"\n \t Area of Rectangle is............"<<area;
return 0;
}
Flowchart for Practical#02
“Program to input length in centimeter and convert it into meter.”
Start
Declare Variable
Float centimeter
Declare Variable
Float meter
Read
centimeter
meter=centimeter/100
Write
meter
Stop
Source Code:-
#include<iostream>
using namespace std;
int main ()
{
float centimeter, meter;
cout<<"\n \t \t CONVERT CENTIMETER INTO METER";
cout<<"\n \t \t ************************************* ";
cout<<"\n \t Enter Length into Centimeter \t";
cin>>centimeter;
meter=centimeter/100;
cout<<"\n \t Converted Length into Meter ............"<<meter;
return 0;
}
Flowchart for Practical#03
“Program to convert temperature from Fahrenheit into Celsius.”
Start
Declare Variable
Float feh & cel
Read
fah
Write
cel
Stop
Source Code:-
#include <iostream>
using namespace std;
int main ()
{
float fah, cel;
cout<<"\n \n \t \t Convert Fahrenheit into Celsius";
cout<<"\n \t \t ***************************** ";
cout<<"\n \n \t Enter Temperature from Fahrenheit \t";
cin>>fah;
cel=(fah-32)*5/9;
cout<<"\n\n \t Converted Temperature into Celsius ............"<<cel<<char(248)<<"C";
return 0;
}
Flowchart for Practical#04
“Program to takes a number and prints its multiples up to 10.”
Start
Declare Variable
Int t, a, c
Read
t
a=1
a=a+1
True
a<=10? c=t*a
False
Write
Stop t "x" a "=" c
Source Code
#include <iostream>
using namespace std;
int main ()
{
int t,a,c;
cout<<"\n \t \t TABLE OF ANY NUMBER";
cout<<"\n \t \t *************************";
cout<<"\n \t Enter Table Number \t";
cin>>t;
for (a=1;a<=10;a=a+1)
{
c=t*a;
cout<<"\n \t \t \t"<<t<<"x"<<a<<"="<<c;
}
return 0;
}