//Write a program which performs the addition of three number.
/*#include<iostream>
using namespace std;
int main()
{
int no1,no2,no3,sum;
cout<<"\n Enter The First Number :";
cin>>no1;
cout<<"\n Enter The Second Number :";
cin>>no2;
cout<<"\n Enter The Third Number :";
cin>>no3;
sum=no1+no2+no3;
cout<<"\n The Addition Of Given Three Number Is "<<sum;
return 0;
}*/
//Write a program which calculates the square and cube of two number.
/*#include<iostream>
using namespace std;
int main()
{
int fno,sno;
cout<<"\n Enter The First Number :";
cin>>fno;
cout<<"\n Enter The Second Number :";
cin>>sno;
cout<<"\nThe Squre Of First Number is--->"<<fno*fno;
cout<<"\n The Squre Of Second Number is--->"<<sno*sno;
cout<<"\n The Cube Of First Number--->"<<fno*fno*fno;
cout<<"\n The Cube Of Second Number--->"<<sno*sno*sno;
return 0;
}*/
//Write a program which calculates the area and perimeter of square.
/*#include<iostream>
using namespace std;
int main()
{
float len,area,peri;
cout<<"\n Enter Any Side Of Length Of The Square:=>";
cin>>len;
area=len*len;
cout<<"\n The Area Of Square Is--->"<<area;
peri=(4*len);
cout<<"\n The Perimeter Of Square--->"<<peri;
return 0;
}*/
//Write a program which calculates the area and perimeter of rectangle.
/*#include<iostream>
using namespace std;
int main()
{
int lenR,widR,areaR,periR;
cout<<"\n Enter The length of rectangle :->";
cin>>lenR;
cout<<"\n Enter The width of rectangle :->";
cin>>widR;
areaR=lenR*widR;
cout<<"\n Area Of Rectangle--->"<<areaR;
periR=2*(lenR+widR);
cout<<"\n Perimeter Of Rectangle--->"<<periR;
return 0;
}*/
//------------------------------> Q2-------------------------------->
//. Write a progra which takes the age from the user and prints the message whether he/she is eligible
//. Write a progra which prints the message “Congratulation!!!” if each vaccination was done.
/*#include<iostream>
using namespace std;
int main()
{
int age;
cout<<"\n Hey Dear Enter Your Age ->";
cin>>age;
if(age>=18)
cout<<"\n Congratulation! Your Eligible For Takig Vaccine....!";
}*/
//------------------------------------------------------
//Write a program which decides the given number is even or odd
/*#include<iostream>
using namespace std;
int main()
{
int no;
cout<<"\n Enter The Number --->";
cin>>no;
if(no%2==0)
cout<<"\n Given Number Is Even...."<<no;
else
cout<<"\n Given Number Is Odd...."<<no;
return 0;
}*/
//. Write a program to find out the given year is leap or not
/*#include<iostream>
using namespace std;
int main()
{
int year;
cout<<"\n Enter The Year --->";
cin>>year;
if(year%4==0)
cout<<"\n"<<year<<" Is The Leap Year";
else
cout<<"\n"<<year<<" Is Not The Leap Year";
return 0;
}*/
//. Write a program which prints the greater number from the given two number
/*#include<iostream>
using namespace std;
int main()
{
int no1,no2;
cout<<"\n Enter The First Number --->";
cin>>no1;
cout<<"\n Enter The Second Number--->";
cin>>no2;
if(no1>no2)
cout<<"First Number Is Greater Than Second Number...."<<no1<<">"<<no2;
else
cout<<"Second Number Is Greater Than First Number...."<<no2<<">"<<no1;
return 0;
}*/
//Write a program which finds the greater number from the given three number
/*#include<iostream>
using namespace std;
int main()
{
int no1,no2,no3;
cout<<"\n Enter The First Number :->";
cin>>no1;
cout<<"\n Enter The Second Number :->";
cin>>no2;
cout<<"\n Enter The Three Number :->";
cin>>no3;
if(no1>no2&&no1>no3)
cout<<"\n The First Number Is Greater Than From Second Number & Third Number...."<<no1;
else if(no2>no1&&no2>no3)
cout<<"\n The Second Number Is Greater Than From First Number & Third Number...."<<no2;
else
cout<<"\n The Third Number Is Greater Than From Second Number & First Number...."<<no3;
return 0;
}*/
//Write a program in which you entered the percentage of student and then according to the percentage decides the class of the student (First class, second class, pass class or distinction)
//90-100-->TOP
//80-90-->DISTICTION
//70-60--->FIRST CLASS
//60-50--->Second Class
//50-40--->Third Class
//40-35--->Pass
//<35 fail
/*#include<iostream>
using namespace std;
int main()
{
int percentage;
cout<<"\nEnter The Percentage :=>";
cin>>percentage;
if(percentage>=90&&percentage<=100)
cout<<"\nCongragulation, Your Topper";
else if(percentage>=80&&percentage<=90)
cout<<"\n First Class";
else if(percentage>=70&&percentage<=80)
cout<<"\n Second Class";
else if(percentage>=60&&percentage<=70)
cout<<"\n Third Class";
else if(percentage>=35&&percentage<=60)
cout<<"\n Pass Class";
else if(percentage>100)
cout<<"\n Enter A Valid Percentage";
else
cout<<"\nFail";
return 0;
}*/
//Write a program which performs the addition, subtraction, multiplication, division as per the choice entered by the user.
/*#include<iostream>
using namespace std;
int main()
{
int no1,no2,temp,ch;
cout<<"\n Enter Your Choice--->\n1.Addition \n2.Substraction \n3.Multiplication \n4.Dividation....";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\n Enter The First Number :=>";
cin>>no1;
cout<<"\n Enter The Second Number :=>";
cin>>no2;
temp=no1+no2;
cout<<"\n Addition Of "<<no1<<" and "<<no2<<" is "<<temp;
break;
case 2:
cout<<"\n Enter The First Number :=>";
cin>>no1;
cout<<"\n Enter The Second Number :=>";
cin>>no2;
temp=no1-no2;
cout<<"\n Substraction Of"<<no1<<" and "<<no2<<" is "<<temp;
break;
case 3:
cout<<"\n Enter The First Number :=>";
cin>>no1;
cout<<"\n Enter The Second Number :=>";
cin>>no2;
temp=no1*no2;
cout<<"\n Multiplication Of"<<no1<<" and "<<no2<<" is "<<temp;
break;
case 4:
cout<<"\n Enter The First Number :=>";
cin>>no1;
cout<<"\n Enter The Second Number :=>";
cin>>no2;
temp=no1/no2;
cout<<"\n Dividation Of"<<no1<<" and "<<no2<<" is "<<temp;
break;
deafault :
cout<<"\n Enter The Valid Choice...!";
}
return 0;
}*/
//Using Switch statement, write a program that displays the following menu for the food items available to take order from the customer: •B=Burger •F=French-fries •P=Pizza •S=Sandwiches The program inputs the type of food and quantity. It finally displays thetotal charges for the order according to following criteria: •Burger=Rs.200 •French-fries=Rs.50 •Pizza=Rs.500 • Sandwiches= Rs. 150
/*#include<iostream>
using namespace std;
int main()
{
char ch;
cout<<"\nEnter Your Choice ....\nB=Burger \nF=French-fries \nP=Pizza \nS=Sandwiches\n....";
cin>>ch;
switch(ch)
{
case 'B':
cout<<"Burger=Rs.200";
break;
case 'F':
cout<<"French-fries=Rs.50";
break;
case 'P':
cout<<"Pizza=Rs.500";
break;
case 'S':
cout<"\nSandwiches=Rs. 150";
break;
default :
cout<<"\n Enter The Valid Choice....!";
}
return 0;
}*/
//------------------Q3-------------------------
//Write a program which calculates the factorial of a number
/*#include<iostream>
using namespace std;
int main()
{
int no,fact=1;
cout<<"\nEnter The Number :=>";
cin>>no;
do
{
fact*=no;
no--;
}while(no!=0);
cout<<"The Given Number Factorial Is ...."<<fact;
return 0;
}*/
//Write a program which prints that entered number is prime or not
/*#include<iostream>
using namespace std;
int main()
{
int no,prime,check=0;
cout<<"\n Enter The Number :=>";
cin>>no;
for(int i=1;i<=no;i++)
{
if(no%i==0)
{
check++;
}
}
if(check==2)
cout<<"The Given Number Is Prime..."<<no;
else
cout<<"\n The Given Number Is Not Prime"<<no;
return 0;
}*/
//Write a program which checks that given number is palindrome or not
/*#include<iostream>
using namespace std;
int main()
{
int no,reminder,save=0,q=0;
cout<<"\n Enter The Number :=>";
cin>>no;
q=no;
while(no!=0)
{
reminder=no%10;
save=save*10+reminder;
no=no/10;
}
if(q==save)
cout<<"\n Given Number Is Palidrome...!";
return 0;
}*/
//Write down a program to find out the addition from 1 to 10
/*#include<iostream>
using namespace std;
int main()
{
int add=0;
for(int i=1;i<=10;i++)
add+=i;
cout<<"\n The Addition Of 1 To 10 Is "<<add;
return 0;
}*/
//Write down the program which prints the Fibonacci series (i. e. 1 1 2 3 5 8 13 -----)..
/*#include<iostream>
using namespace std;
int main()
{
int a=0,b=1,c=0;
cout<<a;
for (int i=0;i<=10;i++)
{
a=b;
b=c;
c=a+b;
cout<<c<<"";
}
return 0;
}*/
//Write a program which performs the addition, subtraction, multiplication of two matrix by using 2 D array
/*#include<iostream>
using namespace std;
int main()
{
int mat1[2][2],mat2[2][2],save=0,store[2][2],a,b;
cout<<"\n Enter The First Matrix:=>";
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
cin>>mat1[a][b];
}
cout<<"\n Enter The Second Matrix:=>";
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
cin>>mat2[a][b];
}
cout<<"\n First Matrix Is ....!\n";
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
cout<<mat1[a][b]<<"\t";
cout<<"\n";
}
cout<<"\n Second Matrix Is ....!\n";
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
cout<<mat2[a][b]<<"\t";
cout<<"\n";
}
for(a=0;a<=1;a++)//Addition
{
for(b=0;b<=1;b++)
store[a][b]=mat1[a][b]+mat2[a][b];
cout<<endl;
}
cout<<"\n Addition Of Two Matrix....\n";
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
cout<<store[a][b]<<"\t";
cout<<endl;
}
for(a=0;a<=1;a++) //Substraction
{
for(b=0;b<=1;b++)
store[a][b]=mat1[a][b]-mat2[a][b];
cout<<endl;
}
cout<<"\n Substraction Of Two Matrix....\n";
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
cout<<store[a][b]<<"\t";
cout<<endl;
}
for(int m=0;m<=1;m++)
{
for(int o=0;o<=1;o++)
{
for(int i=0;i<=1;i++)
{
save+=mat1[m][i]*mat2[i][o];
}
store[m][o]=save;
save=0;
}
}
cout<<"\n Multiplication Of Two Matrix Is As Follow \n";
for(int k=0;k<=1;k++)
{
for(int r=0;r<=1;r++)
cout<<store[k][r]<<"\t";
cout<<endl;
}
return 0;
}*/
//Write a program which compares two integers and two floats and prints the greater number by function overloading
/*#include<iostream>
using namespace std;
void greatNumber(int,int);
void greatNumber(float,float);
int main()
{
int no1,no2;
float fno1,fno2;
cout<<"\nEnter The First Integer Number :-->";
cin>>no1;
cout<<"\n Enter The Second Integer Numner :-->";
cin>>no2;
cout<<"\nEnter The First Float Number :-->";
cin>>fno1;
cout<<"\n Enter The Second Float Number :-->";
cin>>fno2;
greatNumber(no1,no2);
greatNumber(fno1,fno2);
}
void greatNumber(int no1,int no2)
{
if(no1>no2)
cout<<"\n First Number Greater Than Second Number...!"<<no1<<">"<<no2;
else
cout<<"\n Second Number Greater Than First Number...!"<<no2<<">"<<no1;
}
void greatNumber(float fno1,float fno2)
{
if(fno1>fno2)
cout<<"\n First Number Greater Than Second Number...!"<<fno1<<">"<<fno2;
else
cout<<"\n Second Number Greater Than First Number...!"<<fno2<<">"<<fno1;
}*/
//. Write a program which calculates the area of square and rectangle by using same function name.
/*#include<iostream>
using namespace std;
float area(float);
float area(float,float);
int main()
{
float side_sqr,len_rect,wid_rect,area_s,area_r;
cout<<"\n Enter The Value Of Any Side Square:-->";
cin>>side_sqr;
cout<<"\n Enter The Length Of Rectangle:-->";
cin>>len_rect;
cout<<"\n Enter The Width Of Rectangle:-->";
cin>>wid_rect;
area_s=area(side_sqr);
cout<<"\n The Area Of Squre Is ...."<<area_s;
area_r=area(len_rect,wid_rect);
cout<<"\n The Area Of Rectangle Is...."<<area(len_rect,wid_rect);
return 0;
}
float area(float side_s)
{
return side_s*side_s;
}
float area(float len_r,float wid_r)
{
return len_r*wid_r;
}*/
Comments
Post a Comment