Program in C++ to find the greatest number among four given numbers using function
#include<iostream> #include<conio.h> using namespace std; int Greater(int a,int b,int c,int d) { if(a>b&&a>c&&a>d) return a; else if(b>c&&b>d) return b; else if(c>d) return c; else return d; } int main() { int j,k,l,m; cout<<"Enter 4 nos.:-", cin>>j>>k>>l>>m; int r=Greater(j,k,l,m); cout<<r<<" is greater."; getch(); return 0; }Output:-
0 Comments