Ask Question
18 May, 18:06

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

+3
Answers (1)
  1. 18 May, 21:35
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers