c program for the largest of two numbers

Solutions on MaxInterview for c program for the largest of two numbers by the best coders in the world

showing results for - "c program for the largest of two numbers"
Marlene
23 Jun 2019
1#include <stdio.h>
2int main() {
3    double n1, n2, n3;
4    printf("Enter three different numbers: ");
5    scanf("%lf %lf %lf", &n1, &n2, &n3);
6
7    // if n1 is greater than both n2 and n3, n1 is the largest
8    if (n1 >= n2 && n1 >= n3)
9        printf("%.2f is the largest number.", n1);
10
11    // if n2 is greater than both n1 and n3, n2 is the largest
12    if (n2 >= n1 && n2 >= n3)
13        printf("%.2f is the largest number.", n2);
14
15    // if n3 is greater than both n1 and n2, n3 is the largest
16    if (n3 >= n1 && n3 >= n2)
17        printf("%.2f is the largest number.", n3);
18
19    return 0;
20}
21
Ahmed
28 Nov 2020
1/*Program for adding two numbers*/
2#include <stdio.h>
3int main(){
4	int a, b;
5    printf("Enter the first number: \n"); //Prompts user to enter the first number.
6    scanf("%d", &a);//Accepts input and saves it to variable a
7    printf("Enter the second number: \n");
8    scanf("%d", &b);//Accepts input and saves it to variable a
9    if (a > b){
10    	printf("%d is greater than %d", a, b);
11        }
12    else
13    	printf("%d is greater than %d", b, a);
14}
Jana
24 Aug 2018
1#include <stdio.h>
2int main() {
3    double n1, n2, n3;
4    printf("Enter three numbers: ");
5    scanf("%lf %lf %lf", &n1, &n2, &n3);
6
7    if (n1 >= n2) {
8        if (n1 >= n3)
9            printf("%.2lf is the largest number.", n1);
10        else
11            printf("%.2lf is the largest number.", n3);
12    } else {
13        if (n2 >= n3)
14            printf("%.2lf is the largest number.", n2);
15        else
16            printf("%.2lf is the largest number.", n3);
17    }
18
19    return 0;
20}
21
Bautista
07 Jun 2018
1#include <stdio.h>
2int main() {
3    double n1, n2, n3;
4    printf("Enter three numbers: ");
5    scanf("%lf %lf %lf", &n1, &n2, &n3);
6
7    // if n1 is greater than both n2 and n3, n1 is the largest
8    if (n1 >= n2 && n1 >= n3)
9        printf("%.2lf is the largest number.", n1);
10
11    // if n2 is greater than both n1 and n3, n2 is the largest
12    else if (n2 >= n1 && n2 >= n3)
13        printf("%.2lf is the largest number.", n2);
14
15    // if both above conditions are false, n3 is the largest
16    else
17        printf("%.2lf is the largest number.", n3);
18
19    return 0;
20}
21
queries leading to this page
second largest number among three numbers in cprogram to find largest of n numbers in cfind greatest of 3 numbers in cbiggest numbers in clargest of n numbers in cgreatest of 3 numbers in cwrite a c program to find largest among 3 numbers largest among 3 numbers in clargest number among three numbers in cwrite a c program to find the largest of three numbers given by user find largest no from set of 3 numbers in cfind the largest number among 2 numbers in c languagewrite a c program to display largest of three numbersfind largest of 3 digit numbers in cfind program to find largest of three numberc program to find maximum of three numbersfind the greatest of three numbers in cgreatest in three numbers in chow find largest number among all numbers in cc program to compare two numbers and find the biggest among themprint the largest number among the three using cgreatest of three numbers in cprogram to find greatest of four numbers in cwrite a program in c to find the largest number from three numbers using if else c program to find the greatest of four numbersfind largest of three numbers in clargest of 2 numbers in csecond largest among three numbers in cc program to find largest of n numbersfind the largest numberfind largest of 2 numbers in c without iflargest number program in cto find the greatest of three numbers in cthis program prints the largest of three integers cmax number in 3 numberprogram to find the largest number among three numbers in cc program largest numberhow to find the biggest number between 2 in cwrite a c program to find maximum between two numbersgreater of 3 numbersc program to find largest of n numberc program to find the largest of three numbersgreatest of 3 number in c write the program to find the largest among three number in cprogram to find largest of 2 numbers in cgiven three integers calculate the maximum integer among the given integers finding large number statement in c 2b 2bsecond largest among three integers in cwrite a program in c to find the largest number from three numbers using if elsec program to find out largest of three integer numbers write a c program for finding the largest of given 2 numberswrite a c program to find the largest of three numbers write a program that finds the largest of the entered n integers cmaximum of two numbers in cwrite a program to find greatest of three numbers in cfind greatest of three numbers in cfind the largest of three numbers in cc program for the largest of two numbersbiggest of three numbers in carrange given numbers to form the biggest number in cc program to find maximum between two numbersc program to find largest of 3 numbersc program to find maximum of 2 numberswrite a c program to find maximum between three numbers create a c program to print maximum of three numbers using nested if else statement biggest of 3 numbers in cgreatest three numbers clargest of 3 numbers in cfind the largest of three numbers using nested if elseprogram to find greatest of three numbers in cwrite a c program find the maximum between two numbers write a c program to find the largest number 28integer 29 among three numbers 28integers 29 using if and logical 26 26 operator cmaximum of three numbers in cwrite a c program to find largest among three numbers with if elsec program to find the largest number among ten numbersfind the largest among 3 numbers in cfind largest of 4 numbers cc program to find the largest number among five numberslargest among 2 number c programwrite a c program to find maximum between three numberswrite a c code to check for the largest of 3 numberswrite a c program to find the largest of two numbers using a function write a c program to check the largest number among given three numberslargest on n numbers in clargest of three numbers in cwrite a c program to find the greatest of three numberslargest of 4 numbers in cc program to find the largest number among three numbersfind largest of 2 numbers in c with no ifc program to find largest of three numbersc code to find largest of three numbersfind the largest of 3 numbers in ccode to find the largest number in the given 2 numbers in cwrite a c program to find the largest number 28integer 29 among three numbers 28integers 29 using if and logical 26 26 operator program to find the largest of 4 numbers in cgreatest of 2 numbers in cwrite a c program to find maximum between two numbers find largest and smalleswt of three numbers in chow to find greatest of 3 numbers in cwrite program for enter three numbers from user and find greater using nested if 3flarger of three numbers in cfind the largest of n numbers in c programhow to find largest 3 digit number in clargest integer in cmaximum of two numbers program in cc program to find largest of three numbers without using if statementlargest no among three in csecond greatest of three numbers in clargest digit in a number in cc program for the largest of two numbers