Finding The Greatest Number using C

 include <stdio.h>


int main() {

    int num1, num2, num3, num4;

    // Assume the values are assigned to num1, num2, num3, and num4

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

  printf("enter any four numbers\n");

  scanf("%d\n",&num1);

  scanf("%d\n",&num3);

  scanf("%d\n",&num2);

  scanf("%d\n",&num4);

  //logic for finding the greatest one

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

        printf("%d is the greatest number", num1);

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

        printf("%d is the greatest number", num2);

    } else if (num3 > num4) {

        printf("%d is the greatest number", num3);

    } else {

        printf("%d is the greatest number", num4);

    }

    return 0;

}

🔗Link:https: //replit.com/@AquaLeagen/Greatest-one-outzafar-sir?s=app

Comments

Popular Posts