Friday, 30 September 2016

Thursday, 29 September 2016

Wednesday, 28 September 2016

WAP for bigger out of two using functions

WAP for bigger out of two using functions

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);
}

Tuesday, 27 September 2016

Wap to check if given value is vowel or not

Wap to check if given value is vowel or not

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( );
}

Thursday, 8 September 2016

WAP to find compound interest.

WAP to find compound interest.

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.

WAP to exchange value of two variables.

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