Ask 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 see which number is larger

+4
Answers (1)
  1. 3 July, 04:25
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers