You are on page 1of 1

Program 1.

1
Write a program to accept integers and print the largest of the three. Make use of only if statement.

#include<iostream.h>

int main()

int x,y,z,max;

cout<<”Enter three number:”;

cin>>x>>y>>z;

max=x;

if(y>max)

max=y;

if(z>max)

max=z;

cout<<”\n”<<”the largest of”<<x<<”,”

<<y<<”and”<<z<<”is”<<max;

return 0;

Enter three number :- 6 8 10

The largest of 6 ,8 and 10 is 10

You might also like