Você está na página 1de 33

(PROGRAMING)

SUB.TO:-Er. Kamlajit Singh

SUB.BY:-Amit Gupta
Course:-B.Tech
Branch:-Civil (2nd sem)
Roll:-1141097

Program no.-01

//program to write your name//


#include<iostream.h>
#include<conio.h>
Void main()
{
Clrscr ();
Cout<<Amit Kumar Gupta;
getch ();
}

OUTPUT:-

Program no.-02

// write a program to sum of two numbers//


#include<iostream.h>
#include<conio.h>
Void main()
{
Clrscr ();
Int a, b, c;
Cout<<enter first number=;
Cin>>a;
Cout<<enter 2nd number=;
Cin>>b;
C=a+b;
Cout<<sum of two numbers are=;
Cout<<c;
Getch ();
}

OUTPUT:-

Program no.-03

//write a program to sum of three number//

#include<iostream.h>
#include<conio.h>
Void main()
{
Clrscr ();
Int a, b, c, d;
Cout<<enter 1st number=;
Cin>>a;
Cout<<enter 2nd number=;
Cin>>b;
Cout<<enter 3rd number=;
Cin>>c;
d=a+b+c;
cout<<sum of three numbers are=;
cout<<d;
getch();
}

OUTPUT:-

Program no.-04

//write a program to change temperature from centigrade to


Fahrenheit//
#include<iostream.h>
#include<conio.h>

Void main()
{
Clrscr ();
Float f, c;
Cout<<enter todays temperature=;
Cin>>c;
f= (1.8*c) +32;
cout<<The temperature in FAHRENHEIT is=;
Cout<<f;
getch ();
}

OUTPUT:-

Program no.-05

//write a program to find area and circumference of the circle//


#include<iostream.h>
#include<conio.h>

#define pi 3.14
Void main()
{
Clrscr();
float r, a, c;
cout<<enter radius of the circle=;
cin>>r;
a=pi*r*r;
c=2*pi*r;
cout<<area of the circle=;
cout<<a;
cout<<\n circumference of the circle=;
cout<<c;
getch ();
}

OUTPUT:-

Program no.-06

//write a program to find area and volume of the sphere//


#include<iostream.h>
#include<conio.h>

#define pi 3.14
Void main()
{
Clrscr ();
Float r, a, v;
Cout<<enter radius of the sphere=;
Cin>>r;
a=4*pi*r*r;
v=4/3*pi*r*r*r;
cout<<area of the sphere=;
Cout<<a;
cout<<\n volume of the sphere=;
cout<<v;
getch ();
}

OUTPUT:-

Program no.-07

//write a program to find average of four number//


#include<iostream.h>
#include<conio.h>
Void main()

{
clrscr ();
float a, b, c, d, s, r;
cout<<Enter 1st number=;
cin>>a;
cout<<Enter 2nd number=;
cin>>b;
cout<<Enter 3rd number=;
cin>>c;
cout<<Enter 4th number=;
cin>>d;
s=a+b+c+d;
r=s/4;
cout<<Average of four number=;
cout<<r;
getch();
}

OUTPUT:-

Programno.-08

//write a program to find grade//

#include<iostream.h>
#include<conio.h>
void main()
{
float per;
char grade=*;
clrscr ();
cout <<\n Enter percentage=;
cin>>per;
if(per)=80)
{
grade=A;
}
cout<<\n Result is pass;
cout<<\n Grade is =<<grade;
getch();
}

OUTPUT:-

Programno.-09

//write a program to find even or odd number//


#include<iostream.h>

#include<conio.h>
void main()
{
int n;
cout<<\n Enter the number=;
cin>>n;
If(n%2==0)
cout<<\n The number is even;
else
cout<<The number is odd;
getch();
}

OUTPUT:-

Programno.-10

//write a program to find grade//

#include<iostream.h>
#include<conio.h>
void main()
{
int fcpit,chem,math,total;
float per;
char grade;
clrscr();
cout<<pls Enter the marks of fcpit,chem.,math=;
cin>>fcpit>>chem>>math;
total=fcpit+chem+math;
per=total/3;
if(per)=80)
{
grade=A;
}
else if(per)=60)
{
grade=B;
}
else if(per)=40)
{
grade=C;
}
else
{
grade=F;
}

cout<<\n Grade is =<<grade;


getche();
}

OUTPUT:-

Programno.-11

//write a program to check colour//


#include<iostream.h>
#include<conio.h>
void main()

{
char choice;
clrscr();
cout<<\n \t MAIN MENU;
cout<<\n R. For Red colour;
cout<<\n W. For White colour;
cout<<\n B. For Blue colour;
cout<<\n Y. For yellow colour;
cout<<\n please enter your choice=;
cin>>choice;
switch(choice)
{
caser:
caseR:
cout<<\n colour is Red;
break;
casew:
caseW:
cout<<\n colour is white;
break;
caseb:
caseB:
cout<<\n colour is blue;
break;
casey:
caseY:
cout<<\n colour is yellow;
break;

default:
cout<<\n colour does not found;
}
getch();
}

OUTPUT:-

Programno.-12

//write a program to find salary//


#include<iostream.h>
#include<conio.h>
void main()
{
int sal,bp;
clrscr();

cout<<\n Enter the basic pay=;


cin>>bp;
sal=(bp!=1000)?((bp<1000)?4*bp+500:2*bp+1000):2000;
cout<<\n Salary is =<<sal;
getche();
}

OUTPUT:-

Programno.-13

//write a program to find the average of n numbers//


#include<iostream.h>
#include<conio.h>
void main()
{
Int i,sum,n;
float av;
clrscr();
cout<<\n Enter the value of n=;

cin>>n;
sum=0;
i=1;
while(i<=n)
{
sum=sum+1;
i=i+1;
}
av=(float)sum/n;
cout<<\n sum is=<<sum;
cout<<\n average is=<<av;
getche();
}

Program no.-14

//write a program to find Even or Odd number//


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;
void disp();
cout<<"Enter a no.=";
cin>>a;
if(a%2==0)
{

disp();
cout<<"Even";
}
else
{
disp();
cout<<"odd";
}
getch();
}
void disp()
{
cout<<"The Entered no. is =";
}

OUTPUT:-

Program:-15

//write a program to print number 1 to 10 using do while loop.//


#include<iostream.h>
#include<conio.h>
void main()
{
int a=1;
do
{
cout<<a;
cout<<"\n";
a++;
}
while(a<=10);
getch();

OUTPUT:-

Program No:-16

//write a program to print 1to 10 using while loop.//


#include<iostream.h>
#include<conio.h>
void main()
{
int a=1;
while(a<=10)
{
cout<<a;
cout<<"\n";
a++;
}
getch();
}

OUTPUT:-

Program No.:-17

//Write a program to print 10 to 1 no. //


#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a=1;
do
{
cout<<a<<"\n";
a++;
}
while(a<=10);
getch();
}

OUTPUT:-

Program no.:-18

//write a program to print 10 to 1 no.//


#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int a=10;
do
{
cout<<a;
a--;
}
while(a>=1);
getch();
}

OUTPUT:-

Program no:-19

// Write a program to make a Matrix//


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[10][10],n,m,i,j;
cout<<"\n Row and columns";
cin>>n>>m;
cout<<"\n Enter array elements=";
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
cin>>a[i][j];
}
}
cout<<"\n Matrix is=\n";
for(i=1;i<=n;i++)
{

for(j=1;j<=m;j++)
{
cout<<a[i][j];
}
cout<<"\n";
}
getch();
}

OUTPUT:-

Você também pode gostar