C program to find the greatest of four numbers.

1 Answer

Answer :

#include <stdio.h>

int main()

{

    int num1, num2, num3, num4;

    int greatest;

    printf("Enter four numbers: ");

    scanf("%d %d %d %d", &num1, &num2, &num3, &num4);

    if(num1 > num2 && num1 > num3 && num1 > num4)

        greatest = num1;

    else if(num2 > num3 && num2 > num4)

        greatest = num2;

    else if(num3 > num4)

        greatest = num3;

    else

        greatest = num4;

    printf("Greatest of four numbers is %d", greatest);

    return 0;

}

Related questions

Description : Class 12 | Maths | Complex Numbers | Simplify the following complex numbers and find their modulus.

Last Answer : Class 12 | Maths | Complex Numbers | Simplify the following complex numbers and find their modulus.

Description : Class 12 | Maths | Complex Numbers | Simplify -2i ( 3 + i )( 2 + 4i )( 1 + i ) and obtain the modulus of that complex number.

Last Answer : Solution :

Description : Class 12 | Maths | Complex Numbers | Express the complex numbers modulus-amplitude form  - √3 + i

Last Answer : Solution : 

Description : What is filament of spirogyra?

Last Answer : Spirogyra is a genus of green algae that is commonly found in freshwater environments such as ponds, streams, and ditches. The filament of Spirogyra is a long, slender, multicellular structure ... , which occurs when the filament breaks into individual cells that can grow into new filaments.

Description : In which direction the induced current will flow in an AND WHY?

Last Answer : The direction of an induced current in a conductor is determined by the direction of the changing magnetic field that is inducing the current, as well as the direction of the movement of the ... induction that is based on the interaction between a magnetic field and the movement of a conductor.

Description : Speech the importance of newspaper.

Last Answer : Newspapers play an important role in our daily lives, providing us with the information we need to stay informed about the world around us. They are an essential source of news, analysis, and ... to be an important source of news, analysis and commentary, and their importance cannot be overstated.

Description : Who was Walter Lipmann?

Last Answer : Walter Lippmann (1889-1974) was an American journalist, political commentator, and public intellectual. He was a leading figure in the field of political commentary and analysis in the United States ... he is considered to be one of the most important political commentators of the 20th century.

Description : ___is rupture of red cells with release of intracellular haemoglobin can occur if the Antibody has the property of hemolysin. a) Agglutination b) Hemolysis c) Reaction

Last Answer : b) Hemolysis is the rupture of red blood cells with the release of intracellular hemoglobin, and it can occur if the antibody has the property of hemolysin. Hemolysis is the destruction or ... bacteria, and viruses, and it is a key principle in many diagnostic tests for infectious diseases.

Description : ___is defined as clumping of particles that have antigen on their surface and is brought about by anti-bodies. a) Agglutination b) Hemolysis c) Reaction

Last Answer : a) Agglutination is defined as clumping of particles that have antigen on their surface and is brought about by antibodies. Agglutination is a phenomenon that occurs when there are particles with antigens on ... reactions. In this context, it's not specific enough to be an answer to the question.

Description : Write a C++ program to find greatest number among two numbers from two different classes using friend function.

Last Answer : include #include class second; class first { int x; public: void getx() { coutx; } friend void max(first,second); }; class second { int y; public: void gety() { couty; } friend void max(first,second); }; void max(first a,second b) { if(a.x>b.y) { cout

Description : Compute the greatest common divisor (GCD) of numbers in Python -Web-Development

Last Answer : answer:

Description : What is Least to greatest with numbers 36.837, 36.783, 36.878, 36.8375?

Last Answer : 36.837, 36.783, 36.878, 36.8375

Description : How do you express the sum of each pair of numbers as a product of the greatest common factor of the numbers and another number?

Last Answer : Pick a pair of numbers.Let's try 30 and 42.Their GCF is 6.6 x 5 and 6 x 7By the distributive property, that can be written as 6(5 +7)

Description : What numbers are from Least to greatest 8.200 ML 0.005 KL 8.1 L?

Last Answer : 0.005KL, 8.1 L, 8.200 ML (ML = megalitres).

Description : What numbers are from Least to greatest 8.200 ML 0.005 KL 8.1 L?

Last Answer : 0.005KL, 8.1 L, 8.200 ML (ML = megalitres).

Description : Which educational children's program had the greatest impact on you when you were growing up?

Last Answer : The Mickey Mouse Club and Engineer Bill.

Description : What is that which, supposing it's greatest breadth to be four inches, length nine inches, and depth three inches and contains a solid foot? -Riddles

Last Answer : A shoe.

Description : What is the Greatest common factor of four and 12?

Last Answer : Since 4 is a factor of 12, it is automatically the GCF.