//program to find max of 4 integers; #include <iostream> #include<iomanip> using namespace std; int main() { int n1,n2,n3,n4,max; cout<<"enter 4 numbers "<<endl; cin>>n1>>n2>>n3>>n4; max = (n1 > n2) ? (n1 > n3 ? (n1 > n4 ? n1 : n4) : (n3 > n4 ? n3 : n4)) : (n2 > n3 ? (n2 > n4 ? n2 : n4) : (n3 > n4 ? n3 : n4)); cout<<max<<endl; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter