Research Area

Ashutosh Dubey

Saturday, April 3, 2010

1. Write a program to print a welcome msg ": welcome in c++"?


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"welcome in c++";

getch();

}

2. Write a program to enter three numbers to print the sum, multiplication, division?


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,sum,div,pdt;

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"enter two no.";

cin>>a>>b;

cout<<"sum"<<a+b;

cout<<"\ndiv"<<a/b;

cout<<"\nmul

"<<a*b;

getch();

}

3. Write a program to swap two numbers using third variable?


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,c;

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"enter a &b";

cin>>a>>b;

c=a;

a=b;

b=c;

cout<<a<<"\n"<<b;

getch();

}

4. Write a program to swap two numbers without using third variable?


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b;

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"enter a &b";

cin>>a>>b;

a=a+b;

b=a-b;

a=a-b;

cout<<a<<"\n"<<b;

getch();

}

5. Write a program to enter the radius of the circle and find the area of the circle?


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

float r,area;

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"enter radius";

cin>>r;

area=3.142*r*r;

cout<<"area"<<area;

getch();

}

6. Write a program enters the three sides of triangles and find area of triangle by hero’s formula?




#include<iostream.H>

#include<conio.h>

#include<math.h>

void main()

{

clrscr();

float a,b,c,s,t;

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"enter the three sides of the triangle";

cin>>a>>b>>c;

s=(a+b+c)/2;

cout<<s;

t=sqrt(s*(s-a)*(s-b)*(s-c));

cout<<t;

getch();

}

7. Write a program for beggars’ associations where we have four cups first cup accept 50 rps 2nd cup accept 100 rs 3rd cup accept 500rps and 4rth cups accept 1000 rs enter the amount whatever the user wants print total number of rupees and the total amount?


#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int A,B,C,D,TOTAL,MONEY;

cout<<"\t\t\t\t\tgaurav agarwal"<<endl;

cout<<"ENTER THE NOTES IN A";

cin>>A;

cout<<"ENTER THE NOTES IN B";

cin>>B;

cout<<"ENTER THE NOTES IN C";

cin>>C;

cout<<"ENTER THE NOTES IN D";

cin>>D;

TOTAL=A+B+C+D;

MONEY=(A*50)+(B*100)+(C*500)+(D*1000);

cout<<"TOTAL NOTES IN CUPS ARE ="<<TOTAL<<endl;

cout<<"TOTAL MONEY IN CUPS ="<<MONEY;

getch();

}

No comments: