• Embed Doc
  • Readcast
  • Collections
  • 1
    CommentGo Back
Download
 
 //Write a program that reads three numbers, the display  //a)The larges //b)The smalles //(a)C++ program#include<iostream.h>void main(){float x,y,z;cout<<"enter x,y,z";cin>>x>>y>>z;if(x>y){if(x>z)cout<<"largest is"<<x;}else{cout<<"largest is"<<z;}}(a)alternative method or way for largest number #include<iostream.h>void main(){float x,y,z,max;cout<<"enter x,y,z";
1
 
cin>>x>>y>>z;max=x;if(y>max)max=y;if(z>max)max=z;cout<<"largest is"<<max;}}(b)The smallest number #include<iostream.h>void main(){float x,y,z,min;cout<<"enter x,y,z";cin>>x>>y>>z;if(x<y){if(x<z)cout<<"smallest is"<<x;elsecout<<"smallest is"<<z;}else if(y<z)cout<<"smallest is"<<y;} //(a)alternative method or way for largest number #include<iostream.h>
2
 
void main(){float x,y,z,max;cout<<"enter x,y,z";cin>>x>>y>>z;max=x;if(y>max)max=y;if(z>max)max=z;cout<<"largest is"<<max;}(b)Alternative for smallest number #include<iostream.h>void main(){float x,y,z,min;cout<<"enter x,y,z";cin>>x>>y>>z;min=x;if(y<min)min=y;if(z<min)min=z;cout<<"smallest is"<<min;}
3
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...

nice 1 homework will be easier now

You must be to leave a comment.
Submit
Characters: ...