1.

फंक्शन का प्रयोग करते हुए C++ में एक प्रोग्राम लिखिए, जो दिए गए अंकों में से सबसे बड़ा व सबसे छोटा अंक प्राप्त करें। 

Answer»

#include<iostream.h>
#include<conio.n>
int largest (int x, int y);
void main( )
{
int a, b;
cout<<“Enter the first number: “;
cin>>a;
cout<<“Enter the second number: “;
cin>>b;
largest (a, b);
getch( );
}
largest (int a, int b)
{
if(a > b)
cout<<“The first number is greater and second is smaller”;
else
cout<<“The second number is greater and first is smaller”,
}

आउटपुट

Enter the first number: 8
Enter the second number: 5
The first number is greater and second is smaller



Discussion

No Comment Found