Professional Documents
Culture Documents
#include<iostream.h>
#include<conio.h>
int main()
clrscr();
int value1,value2,sum;
cin>>value1;
sum=value1+value2;
cout<<sum;
return 0;
//2: Program to display ASCII code offf a character and vice versa
#include<iostream.h>
int main()
ch=ch+1;
num=ch;
return 0;
//3: Program to calculate and display area of a circle with radious 6 cm.
#include<iostream.h>
int main()
float radious=6.0;
float area;
area=3.14159*radious*radious;
return 0;
}
//4: Program(using a function) to accept a number and print its cube.
#include<iostream.h>
#include<stdlib.h>
float cube(float);
int main()
system("cls");
float num;
cout<<"Enter a number:";
cin>>num;
return 0;
float cube(float a)
return a*a*a;
#include<iostream.h>
int main()
{
int exper,age,salary;
cin>>exper;
cin>>age;
salary=(exper)?((age>35)?6000:(age>28)?4800:3000):2000;
return 0;
//6: The value of e is known to be 2.71828.... Using this value, write a program to
determine the value of the expression : 2-ye2y+4y Obtain value of y from user.
#include<iostream.h>
#include<math.h>
int main()
double result, y;
cin>>y;
result=2-y*exp(2*y)+Pow(4,y);
cout<<"The result of given expression is: "<<result;
return 0;
#include<iostream.h>
int main()
int choice;
double temp,conv_temp;
cout<<"2.Celsius to Fahrenheit"<<"\n";
cin>>choice;
if(choice==1)
cin>>temp;
conv_temp=(temp-32)/1.8;
}
else
cin>>temp;
conv_temp=(1.8*temp)+32;
return 0;
#include<iostream.h>
int main()
char ch;
float a,b,result;
cin>>a>>b;
cin>>ch;
cout<<"\n";
if(ch=='+')
result=a+b;
else
if(ch=='-')
result=a-b;
else
if(ch=='*')
result=a*b;
else
if(ch=='/')
result=a/b;
else
return 0;