11. Write a Program for find the Largest of Two Numbers.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int a,b;
Cout<<"Enter the First Number:";
cin>>a;
Cout<<"Enter the Second Number:";
cin>>b;
if (a>b)
{
Cout<<"a is greater";
}
else
{
Cout<<"b is greater";
}
getch();
}
...................................................................................................................................................................
12. Write a Program for check number is even or odd?
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int a;
Cout<<"Enter the Number:";
cin>>a;
if(a%2 == 0)
{
Cout<<"Number is Even";
}
else
{
Cout<<"Number is Odd";
}
getch();
}
...................................................................................................................................................................
13. Write a Program a number if number is negative find square else find cube of the numbers.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int a,square,cube;
clrscr();
cout<<"Enter the Number:";
cin>>a;
square =a*a;
cube = a*a*a;
if(a<0)
cout<<endl<<"Number is negative and its Square="<<square;
else
cout<<endl<<"Number is positive and its cube = "<<cube;
getch();
}
...................................................................................................................................................................
14. Write a Program to input a number of it is divisible by 3 find its cube else find Power 4.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int num, cube, fourth;
clrscr();
cout<<"Enter the Number:";
cin>>num;
cube=num*num*num;
fourth = num*num*num*num;
if(num%3 == 0)
{
cout<<endl<<"Given Number is divisible by 3 and its cube = "<<cube;
}
else
{
cout<<endl<<"Given Number is divisible by 3 and its power 4 = "<<fourth;
}
getch();
}
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int a,b;
Cout<<"Enter the First Number:";
cin>>a;
Cout<<"Enter the Second Number:";
cin>>b;
if (a>b)
{
Cout<<"a is greater";
}
else
{
Cout<<"b is greater";
}
getch();
}
...................................................................................................................................................................
12. Write a Program for check number is even or odd?
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int a;
Cout<<"Enter the Number:";
cin>>a;
if(a%2 == 0)
{
Cout<<"Number is Even";
}
else
{
Cout<<"Number is Odd";
}
getch();
}
...................................................................................................................................................................
13. Write a Program a number if number is negative find square else find cube of the numbers.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int a,square,cube;
clrscr();
cout<<"Enter the Number:";
cin>>a;
square =a*a;
cube = a*a*a;
if(a<0)
cout<<endl<<"Number is negative and its Square="<<square;
else
cout<<endl<<"Number is positive and its cube = "<<cube;
getch();
}
...................................................................................................................................................................
14. Write a Program to input a number of it is divisible by 3 find its cube else find Power 4.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
int num, cube, fourth;
clrscr();
cout<<"Enter the Number:";
cin>>num;
cube=num*num*num;
fourth = num*num*num*num;
if(num%3 == 0)
{
cout<<endl<<"Given Number is divisible by 3 and its cube = "<<cube;
}
else
{
cout<<endl<<"Given Number is divisible by 3 and its power 4 = "<<fourth;
}
getch();
}
...................................................................................................................................................................
15. Write a Program input calls and calculate bill if calls<500, calls rate is 2 Rs/Call else 2.50/Call.
Answer:
#include<iostream.h>
#include<conio.h>
Void main()
{
{
float call, a, b;
clrscr();
cout<<"Enter the call minutes:";
cin>>call;
a=call*2;
b=call*2.50;
if(call<500)
{
cout<<endl<<"Your call Rate Started with Rs.2/Call";
cout<<endl<<"Total Call Charge ="<<a;
}
else
{
cout<<endl<<"Your Call Rate is started with Rs.2.50/Call;
cout<<endl<<"Total Call Charge="<<b;
}
getch();
}
*********************************************************************************
0 comments:
Post a Comment