PROGRAM:
#include <iostream.h>
#include <conio.h>
int largest(int,int);
void main() {
clrscr();
int a,b;
cout<<"PROGRAM TO FIND LARGEST NUMBER\n";
cout<<"Enter first value : ";
cin>>a;
cout<<"Enter second value: ";
cin>>b;
cout<<largest(a,b)<<" is largest";
getch();
}
int largest(int a,int b) {
if(a>b)
return a;
else
return b;
}
Monday, May 5, 2008
program to find the largest number using user defined function
Write a program in C++ that prints the largest of two number entered from the keyboard. Pass the two numbers to a function as argument, find the largest and return this value to a main function.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment