largest of three numbers in c

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

showing results for - "largest of three numbers in c"
Juniper
05 May 2017
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
Lucas
20 Feb 2018
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}
Roberta
17 Oct 2017
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
Anae
21 Feb 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
code to find the largest number in the given 2 numbers in cwrite a c program to find maximum between two numbers biggest numbers in cfind the largest number among 2 numbers in c languagewrite a c program to find largest among three numbers with if elselargest no among three in cc program to find largest of 3 numbersfind the largest of n numbers in c programgreater of 3 numberswrite a c program to find maximum between three numbers find largest of 2 numbers in c with no ifprogram to find greatest of four numbers in cprogram to find the largest number among three numbers in clargest number among three numbers in cc program to find the greatest of four numberswrite a c program to find the greatest of three numbersc program to compare two numbers and find the biggest among themwrite a c program to find maximum between two numberswrite a c program find the maximum between two numbers greatest in three numbers in clargest of n numbers in clargest of 2 numbers in chow to find greatest of 3 numbers in clargest of 3 numbers in cfind largest of 4 numbers cwrite program for enter three numbers from user and find greater using nested if 3fc program for the largest of two numbersgreatest of three numbers in cprint the largest number among the three using cgreatest of 3 number in c biggest of 3 numbers in cfind the largest numberfinding large number statement in c 2b 2bc code to find largest of three numberslargest among 2 number c programwrite a c program to find the largest of three numbers given by user find largest and smalleswt of three numbers in carrange given numbers to form the biggest number in cmaximum of two numbers program in cfind the largest of three numbers in cwrite the program to find the largest among three number in cwrite a program in c to find the largest number from three numbers using if elselargest among 3 numbers in cwrite a program to find greatest of three numbers in cprogram to find greatest of three numbers in chow to find largest 3 digit number in cwrite a c program to find the largest of three numbers given three integers calculate the maximum integer among the given integers c program to find maximum of three numberslargest of 4 numbers in clargest number program in cwrite a program that finds the largest of the entered n integers cc program to find the largest of three numberswrite a c program for finding the largest of given 2 numbersfind the largest among 3 numbers in cwrite a c program to find maximum between three numbersc program to find largest of three numbersfind largest of three numbers in csecond greatest of three numbers in csecond largest among three integers in cwrite a c program to find the largest of two numbers using a function find largest of 3 digit numbers in cgreatest of 3 numbers in cc program to find the largest number among three numbersc program to find maximum between two numberswrite a program in c to find the largest number from three numbers using if else find greatest of 3 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 greatest of 2 numbers in cfind the largest of 3 numbers in cwrite a c program to display largest of three numbersmax number in 3 numberlargest digit in a number in cc program to find largest of three numbers without using if statementmaximum of three numbers in cc program to find maximum of 2 numberssecond largest among three numbers in cto find the greatest of three numbers in cprogram to find the largest of 4 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 ccreate a c program to print maximum of three numbers using nested if else statement c program to find the largest number among ten numbershow find largest number among all numbers in cc program to find largest of n numbersfind the greatest of three numbers in cgreatest three numbers cfind largest no from set of 3 numbers in cfind greatest of three numbers in clargest integer in cprogram to find largest of 2 numbers in clargest on n numbers in clarger of three numbers in cfind the largest of three numbers using nested if elsesecond largest number among three numbers in clargest of three numbers in cc program to find largest of n numberfind largest of 2 numbers in c without ifc program to find out largest of three integer numbers write a c program to find largest among 3 numbers biggest of three numbers in cfind program to find largest of three numberc program to find the largest number among five numbersthis program prints the largest of three integers cmaximum of two numbers in cprogram to find largest of n numbers in cc program largest numberhow to find the biggest number between 2 in cwrite a c program to check the largest number among given three numberswrite a c code to check for the largest of 3 numberslargest of three numbers in c