Posts

Showing posts from April, 2016

4th sem oopc programs usinng function in cpp

Ø   Write the following programs using FUNCTION in CPP language. 1.        Write a program to find sum of three numbers using functions. 1.        Write a program to find sum of three numbers using functions. #include<iostream.h> #include<conio.h> int sum(int a,int b,int c){     return(a+b+c); } int main(){     int x,y,z;     clrscr();     cout<<"Enter three value:"<<endl;     cin>>x>>y>>z;     cout<<"Sum is "<<sum(x,y,z);     getch();     return 0; } 2.      Write a function big to find largest of two numbers and use this function in the main program to find largest of three numbers.  #include<iostream.h> #include<conio.h> int max(int,int); int max(int ,int ,int); int main(){     int a,b,c;     clrscr();     cout<<"Enter a value : \n";     cin>>a>>b>>c;     cout<<"Max from three value.\n"<<max(a,b,

4th sem oopc programs in CPP (C++)

Ø   Write the following programs in CPP (C++) language. 1.        To find highest of three numbers using if loop. #include<iostream.h> int main(){ int a,b,c; cout<<"Enter three Value of A B and C"<<endl; cin>>a>>b>>c; if(a>b){ cout<<"A is max"<<endl; }else if(b>c){ cout<<"B is max"<<endl; }else{ cout<<"C is max"<<endl; } return 0; } 2.        Write a program to convert degree Fahrenheit to Celsius. #include<iostream.h> #include<conio.h> void main(){    float f,c;    clrscr();    cout<<"Enter fahrenhit temp: \n";    cin>>f;    c=(f-32)*5/9;    cout<<"Farenhit temp \n"<<f;    cout<<"Eguivalent of celcius \n"<<c;    getch();    return 0; }   3.        Write a program to display prime property of a given number. #include<iostream.h> #include<

4th sem oopc programs in C

Ø   Write the following programs in C language. 1.Write a program to find area of a circle. #include<stdio.h> #include<conio.h> #define PI 3.14 int main(){  float r,ans;  printf(" Enter the radius os circule r=");  scanf("%f",&r);  ans=PI*r*r;  printf("\n Radius of the circle is %.2f ",ans);  return 0; } 2.        Write a program for sum of two numbers . #include<stdio.h> #include<conio.h> int main(){     int a,b,c;     printf("\n Enter the value of A=");     scanf("%d",&a);     printf("\n Enter the value of B=");     scanf("%d",&b);     c=a+b;     printf("\n Sum of two number is %d \n",c);     return 0; } 3.        Write a program to swap two numbers using third variable . #include<stdio.h> #include<conio.h> int main(){   int a,b,temp;   printf("Enter two number. \n");