Write a program to find maximum out of three numbers
Answers
hope It helped you
please follow me. ...
Answer:
The Language used:-
1. C++
2.C
1)c++ program
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"enter the three numbers";
cin>>a>>b>>c;
if((a>b)&&(a>c))
{
cout<<"greater"<<a;
}
else if((b>c)&&(b>a))
{
cout<<"greater"<<b;
}
else
{
cout<<"greater"<<c;
}
return 0;
}
output
enter the three numbers 5 9 7
greater 9
2)c program
#include <stdio.h>
int main()
{
int a,b,c;
printf("enter the two numbers");
scanf("%d%d%d",&a,&b,&c);
if((a>b)&&(a>c))
{
printf("greater=%d",a);
}
else if((b>c)&&(b>a))
{
printf("greater=%d",b);
}
else
{
printf("greater=%d",c);
}
return 0;
}
output
enter the three numbers 6 2 1
greater=6