Ask Question
7 March, 19:24

Write a program to read 2 numbers and display the largest of the two. You should use scanfto read the two numbers and use if statement to see which number is larger

+4
Answers (1)
  1. 7 March, 22:17
    0
    Answer: in C

    #include

    int main () {

    int num1, num2;

    printf ("Enter first number : : ");

    scanf ("%d", &num1);

    printf ("Enter second number : : ");

    scanf ("%d", &num2);

    if (num1 > num2) {

    printf ("%d is larger than %d/n", num1, num2);

    } else if (num2 > num1) {

    printf ("%d is larger than %d/n", num2, num1);

    } else{

    printf ("Both of them are equal/n");

    }

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program to read 2 numbers and display the largest of the two. You should use scanfto read the two numbers and use if statement to ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers