The Output of This Program Is As
The Output of This Program Is As
The Output of This Program Is As
h>
#include<conio.h>
Void main ()
Clrscr ();
int a;
float b, c;
cin>>a;
cin>>b;
c=a+b;
getch ();
#include<iostream.h>
#include<conio.h>
void main ()
clrscr ();
int p,t;
float r,s_i;
cin>>p;
cin>>r;
cout<<"\nENTER TIME PERIOD ---> ";
cin>>t;
s_i=p*r*t/100;
getch();
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
cin>>a;
cin>>b;
c=a;
a=b;
b=c;
getch();
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b;
cin>>a;
cin>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"\n the swaped value of first intger is"<<a;
getch();
/*Program no.5- Program to find largest among two number input by user:-*/
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b;
cin>>a;
cin>>b;
if (a>b)
else
getch();
a is greater than b
Program no. 6: To calculate the bill of the three items by deducting discount;
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b;
float c,d,p,t;
cin>>a;
cin>>b;
cin>>c;
t=a+b+c;
if (t>=2000)
d=t*0.5;
else
{ if(t>=1000)
d=t*0.2;
else
{ if (t>=500)
d=t*0.1;
else
d=0;
p=t-d;
getch();
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int day;
cin>>day;
switch (day)
case 1:
break;
case 2:
case 3:
break;
case 4:
break ;
case 5:
break;
case 6:
break ;
case 7:
break ;
default :
getch();
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a;
float b,c;
cout<<"1.Farenheit to celcius"<<"\n";
cout<<"2.celcius to farenheit"<<"\n";
cin>>a;
if(a==1)
cin>>b;
c=(b-32)/1.8;
else
{
cout<<"\n"<<"enter temperature in celcius:";
cin>>b;
c=(1.8*b)+32;
getch();
2.celcius to farenheit
2.celcius to farenheit
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a;
a=0;
{ cout<<"GNDEC "<<endl;}
getch();}
GNDEC
GNDEC
GNDEC
GNDEC
GNDEC
\* Program no 19:- T print int from 1 to 10 *\
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a;
a=1;
{ cout<<a<<” “;}
getch();
1 2 3 4 5 6 7 8 9 10
\* Program no 22:- To print 1,8,27,64,……1000 *\
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
a=1;
b=0;
while (b<1000)
{ b=a*a*a;
cout<<b<<",";
a++;
getch();
1,8,27,64,125,216,343,512,729,1000,
\* Program no 23:- To print table of any input no. *\
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
b=1;
cin>>a;
while (b<=10)
{ c=a*b;
cout<<a<<"*"<<b<<"= "<<c<<endl;
b++; }
getch();
19*1= 19
19*2= 38
19*3= 57
19*4= 76
19*5= 95
19*6= 114
19*7= 133
19*8= 152
19*9= 171
19*10= 190
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c,n,i,j;
a=0;
b=1;
cin>>n;
cout<< a<<endl<<b<<endl;
for(i=1; i<=n-2; i++)
{ c=a+b;
a=b;
b=c;
cout<<c<<endl;}
getch();
13
21
34
55
89
\* Program no 25:- to cal. Factorial of a given number *\
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
cin>>a;
b=1;
while (a>1)
b=b*a;
a=a-1;
cout<<"factorial is :"<<b;
getch();
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
c=0;
cin>>a;
while (a>0)
{ b=a%10;
c=c*10+b;
a=a/10;}
getch();
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c,d;
c=0;
cin>>a;
d=a;
while (a>0)
{ b=a%10;
c=c*10+b;
a=a/10;}
if (d==c)
else {
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
a=1;
{cout<<a;
cout<<endl;
getch();
}
22
333
4444
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a,b,c;
a=1;
{cout<<"*"
}
cout<<endl;
getch();
The output is as :-
**
***
****
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a=5,b,c,d=1;
while (a>=1)
{ b=1;
c=1;
while (b<=a)
{ cout<<" ";
b++;
while(c<=d)
{ cout<<"*";
c++;
cout<<endl;
a--;
d++;
getch();
**
***
****
*****
39) /* Create A Class To Input And Print Record Of Student By Defining Member Function Inside The
Class */
#include<iostream.h>
#include<conio.h>
class student
{
int rno,marks,std;
char name[15];
public:
void read()
{
cout<<"\nEnter name of student:";
cin>>name;
cout<<"\nEnter rno, marks and class:";
cin>>rno>>marks>>std;
}
void display()
{
cout<<"\nName: "<<name;
cout<<"\nRoll No: "<<rno;
cout<<"\nClass: "<<std;
cout<<"\nMarks: "<<marks;
}
};
void main()
{
clrscr();
student k;
k.read();
k.display();
getch();
OUTPUT:
12
Name: Brahmjeet
Class: 12
Marks: 210
#include<iostream.h>
#include<conio.h>
class factorial
{
int n,fact;
public:
void read();
void process();
void display();
};
void factorial::read()
{
cout<<"\n Enter any number:";
cin>>n;
}
void factorial::process()
{
fact=1;
for(int i=1;i<=n;i++)
{
fact=fact*i;
}
}
void factorial::display()
{
cout<<"\nFactorial="<<fact;
}
void main()
{
clrscr();
factorial k;
k.read();
k.process();
k.display();
getch();
}
OUTPUT:
Factorial=120
#include<iostream.h>
#include<conio.h>
class first
{
public:
virtual void yes()
{
cout<<"\nFirst class";
}
};
class second
{
public:
void yes()
{
cout<<"\nSecond class!!!";
};
void main()
{
clrscr();
first *p;
second t;
p=&t;
p->yes();
getch();
}
OUTPUT:
Second class
#include<iostream.h>
#include<conio.h>
class abhay
{
int a,b;
public:
void read()
{
cout<<"\nEnter any two integers:";
cin>>a>>b;
}
void display()
{
cout<<"\n"<<a<<" "<<b;
}
void operator ++()
{
a++;
b++;
}
};
void main()
{
clrscr();
abhay k;
k.read();
k.display();
k++;
cout<<"\nValue after operator overloading:";
k.display();
getch();}
OUTPUT:
1000
45 1000
46 1001