## Wap to find greatest of two numbers using conditional operator.

//Greatest of two numbers using conditional operator.
#include<stdio.h>
#include<conio.h>
void main ( )
{
int a,b,big;
clrscr( );
cout<<"/n Enter two numbers";
cin>>a>>b;
big = (a>b) ? a:b;
cout<<"The greater number ="<<big;
getch( );
}

## Program to print  following pattern.

A
A   B
A   B   C
A   B   C   D
A   B   C   D   E

//program to print the above pattern.
#include<stdio.h>
#include<conio.h>
void main ( )
{
char ch;
int i,j;
clrscr( );
for(i=1;i<=5;i++)
{
ch='A';
for(j=1;j<=i;j++)
{
putchar (ch);
ch++;
}
printf("/n");
}
getch( );
}

## WAP for bigger out of two using functions.

//calculate the bigger out of two given no's using function.

#include<iostream.h>
using namespace std;
void main( )
{
int big(int,int);             //function declaration.
int x,y;
cout<<"enter two numbers:";
cin>>x>>y;
max=big(x,y);                            //function call.
cout<<"Bigger Number="<<max;
}
int big(int a,int b)                                    //function definition.
{
if(a>b)
return(a);
else
return(b);
}

## Wap to check if given value is vowel or not.

//program to find whether entered letter is vowel or not.

#include<stdio.h>
#include<conio.h>
void main( )
{
char ch;
clrscr( );
puts("enter a lowercase letter");
ch=getchar( );
switch(ch);
{
case 'a':
puts("the vowel is a");
break;
case 'e':
puts("the vowel is e");
break;
case 'i':
puts("the vowel is i");
break;
case 'o':
puts("the vowel is o");
break;
case 'u':
puts("the vowel is u");
break;
default :
puts("it is not a vowel");
}
getch( );
}

## WAP to find compound interest.

//Compound interest = Amount-principal
//Amount=Principal*(1+rate/100)^time
//To calculate compound interest.

#include<stdio.h.
#include<conio.h>
#include<math.h>
Void main( )
{
Float p,r,t,a,ci;
Clrscr( );
Printf(“\n Enter principal amount,rate of interest and time”);
Scanf(“%f%f%f”,&p,&r,&t);
A=p*pow((1+r/100),t);
Ci=a-p;
Printf(“\n The compound interest is =%f”,ci);
Getch( );
}
Output.
Enter principal amount, rate of interest and time 5000 12 3
The compound interest = 2024.640137.

## WAP to exchange value of two variables.

//Exchange two variables.

#include<stdio.h>
#include<conio.h>
Void main( )
{
Int a,b,t;
Clrscr( );
Printf(“\n Enter two numbers to be exchanged”);
Scanf(“%d%d”,&a,&b);
T=a;
A=b;
B=t;
Printf(“\n Exchanged numbers are…a=%d\t b=%d”,a,b);
Getch( );
}

Output
Enter two numbers to be exchanged 10 20
Exchanged numbers are….a=20                     b=10