Anda di halaman 1dari 7

Question 1

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,g,h;
cout<<’enter the number”;
cin>>a;
b=a%10;
cout<<b<<endl;
c=a/10;
d=c%10;
cout<<d<<endl;
e=c/10;
f=e%10;
cout<<f<<endl;
g=e/10;
h=g%10;
cout<<h<<endl;
getch();
}

Question 2

A,
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a,b,sum;
cout<<”enter the first number”;
cin>>a;
cout<<”enter the second number”;
cin>>b;
sum=a+b;
cout<<sum;
getch();
}

B,
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a,b,sub;
cout<<”enter the first number”;
cin>>a;
cout<<”enter the second number”;
cin>>b;
sub=a-b;
cout<<sub;
getch();
}

C,
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a,b,product;
cout<<”enter the first number”;
cin>>a;
cout<<”enter the second number”;
cin>>b;
product=a*b;
cout<<product;
getch();
}
D,
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a,b,division;
cout<<”enter the first number”;
cin>>a;
cout<<”enter the second number”;
cin>>b;
division=a/b;
cout<<division;
getch();
}

E,
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a,b,remainder;
cout<<”enter the first number”;
cin>>a;
cout<<”enter the second number”;
cin>>b;
remainder=a%b;
cout<<remainder;
getch();
}

Question 3
A,
#include<iostream.h>
#include<conio.h>
void main()
{
float rad,area;
const float Pi=3.14;
cout<<”enter the radius of circle”;
cin>>rad;
area=4*rad*rad*Pi;
cout<<area;
getch();
}

B,
#include<iostream.h>
#include<conio.h>
void main()
{
float rad,volume;
const float Pi=3.14;
cout<<”enter the radius of circle”;
cin>>rad;
volume=(4*rad*rad*rad*Pi)/3;
cout<<volume;
getch();
}

Question 4

There are 2 methods to slove the question

#include<iostream.h>
#include<conio.h>
void main()
{
float a,b,c,average;
cout<<”enter the first number”;
cin>>a;
cout<<”enter the second number”;
cin>>b;
cout<<”enter the third number”;
cin>>c;
average=(a+b+c)/3;
cout<<average;
getch();
}

Second method involves the use of FOR LOOP

Question 5
#include<iostream.h>
#include<conio.h>
void main()
{
float s,vi,t,a;
cout<<”enter the value of time spent”;
cin>>t;
cout<<”enter the value of initial velocity”;
cin>>vi;
cout<<”enter the value of accerelation”;
cin>.a;
s=(vi*t+1)/(2*a*t*t);
cout<<”The distance covered is:”<<s;
getch();
}

Question 6

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c,m,area;
cout<<”enter the value of a”;
cin>>a;
cout<<”enter the value of b”;
cin>>b;
cout<<”enter the value of c”:
cin>>c;
s=(a+b+c)/2;
cout<<”the value of s_”<<s<<endl;
m=s*(s-a)*(s-b)*(s-c);
area=sqrt(m);
cout<<”area is_”<<area;
getch();
}

Question 7
#include<iostream.h>
#include<conio.h>
void main()
{
int a;
cout<<”enter the marks obtained by the user”;
cin>>a;
if (a>=40)
cout<<”Congratulation! U have Passed”;
else
cout<<”Try next time”;
getch();
}

Question 8
#include<iostream.h>
#include<conio.h>
void main()
{
int a;
cout<<”enter the year”;
cin>>a;
if ( a%4==0)
cout<<”Leap Year”;
getch();
}

Question 9

Question 10

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
cout<<”Enter the first value”;
cin>>a;
cout<<”Enter the scond value”;
cin>>b;
if
(a>b)
cout<<”a=”<<a<<”is greater”;
else
cout<<”b=”<<b<<”is greater”;
getch();
}

Question 11

#include<iostream.h>
#include<conio.h>
void main
{
int i,a,b;
cout<<”enter the starting value”;
cin>>a;
cout<<”enter the ending value”;
cin>>b;
for
(i=a;i<=b;i++)
{
if ( i%2==0)
cout<<i;
}
getch();
}

Array question

#include<iostream.h>
#include<conio.h>
Void main()
{
int num[6];
for ( int j=0;j<6;j++)
{
cout<<”enter the num”;
cin>>num[j];
}
int total=0;
for(j=0;j<6;j++)
total+=num[j];
cout<<”the sum of numbers enetered is:”<<total<<endl;
getch();
}

Anda mungkin juga menyukai