# how to write program greatest number

answered Sep 8 by (140 points)
#include<stdio.h>

int main()

{

int a,b;

printf("Enter the the two number'';

scanf("%d",&a,&b);

if(a>b)

{

printf("a is greater");

}

else

{

printf("b is greater");

}

return 0;

}
+1 vote
answered Sep 9 by (170 points)
#include <stdio.h>

int main()
{
int a, b;
printf("ENTER TWO INTEGER NUMBER\n");
scanf("%d%d", &a, &b) ;
if(a>b)
{
printf("%d is big\n",a) ;
}
else
{
printf("%d is big\n",b);}
}
answered Sep 9 by (300 points)
Here is a C++ program to solve the problem of greatest integers among the given input of 4 integers. if needed for particular number can call the big function the input number of times or use a loop . using array for a list of integers to compare largest among them is more suitable

#include <iostream>

using namespace std;
int big(int x,int y)
{
return(x>y)?x:y;
}

int main()
{
int a,b,c,d,s;
cin>>a>>b>>c>>d;
s=big(big(big(a,b),c),d);
cout<<s;

return 0;
}
+1 vote
answered Sep 15 by (770 points)

Well, here is the simple C++ program to find the largest number.

#include <iostream>
using namespace std;

int main() {
int num1, num2, num3;

// Input three numbers from the user
cout << "Enter three numbers: ";
cin >> num1 >> num2 >> num3;

// Compare the numbers to find the greatest one
if (num1 >= num2 && num1 >= num3) {
cout << "The greatest number is: " << num1 << endl;
} else if (num2 >= num1 && num2 >= num3) {
cout << "The greatest number is: " << num2 << endl;
} else {
cout << "The greatest number is: " << num3 << endl;
}

return 0;
}

Thanks

answered Sep 15 by (140 points)
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
clrscr();
int a,b,c,d,x,y;
printf("Enter first value : ");
scanf("%d",&a);
printf("Enter second value: ");
scanf("%d",&b);
printf("Enter third value:");
scanf("%d",&c);
x=(a+b+abs(a-b))/2;
y=(x+c+abs(x-c))/2;
printf("maximum value=%d",y);
getch();

}