Biggest of 3 Numbers: C program

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024
  • technotip.com/6...
    Lets write C program to find biggest of 3 numbers, using nested if statement.
    Here first we check if a is greater than b. If yes, then we display a as big. Else b or c is biggest. So now we check if b is greater than c, if yes, we display b as biggest else c is biggest. Nested if else condition works great for programs like this.
    C Programming Interview / Viva Q&A List
    technotip.com/6...
    C Programming: Beginner To Advance To Expert
    technotip.com/6...

ความคิดเห็น • 14

  • @noorgul1176
    @noorgul1176 3 ปีที่แล้ว +11

    sir you have written a>b in if-block but sir this isn't true because how will c's value compare !?
    *if c would bigger than even it will say a is bigger i mean only if block execute*

  • @rk2869
    @rk2869 2 ปีที่แล้ว +7

    If(a>b&&a>c){
    printf a is greter
    }else if b>a&&b>c
    printf b is greater
    else
    printf c is greater
    I think this is correct. Sorry for not write properly.

    • @krauser_
      @krauser_ ปีที่แล้ว +2

      It is not correct if a and b are the same and c is lesser. It should be like that:
      if ((a >= b) && (a >= c)) {
      printf("%d is the largest.", a);
      } else if ((b >= a) && (b >= c)) {
      printf("%d is the largest.", b);
      } else {
      printf("%d is the largest.", c);
      }

    • @monzilaislam977
      @monzilaislam977 9 หลายเดือนก่อน

      Im going to tell a simple but noob way:
      if(a>b)
      {
      printf("Big number is: %d",a);
      }
      else if(ac)
      {
      printf("Big number is: %d",b);
      }
      else
      {
      printf("Big number is: %d",c);
      }

  • @user-hy1vn6gp1e
    @user-hy1vn6gp1e ปีที่แล้ว +4

    You are doing it wrong...
    In your code,
    If A is greater than B but less then C, it will show A as the largest number here.

    • @nomorefacts120
      @nomorefacts120 4 หลายเดือนก่อน

      Right bro, bros code is wrong 😂😂

  • @Anvik_Sai
    @Anvik_Sai 6 หลายเดือนก่อน +1

    how to find biggest number among three numbers if all given numbers are equal or same like a=11 and b=11 and c=11 how to aproach this type of problems.

  • @shibashankarnayak50
    @shibashankarnayak50 ปีที่แล้ว +1

    Which software are you using for command writing

    • @technotipDOTorg
      @technotipDOTorg  ปีที่แล้ว

      Hope that helps: technotip.com/6094/the-best-ide-for-c-programming/

  • @user-dl9yc9ep1i
    @user-dl9yc9ep1i 4 หลายเดือนก่อน +1

    aj mei ne kiya board me to bikul sahi ho gya❤

  • @ENTERTAINMENT-ih3ed
    @ENTERTAINMENT-ih3ed 17 วันที่ผ่านมา

    WRONG

  • @nomorefacts120
    @nomorefacts120 4 หลายเดือนก่อน

    Galt hai bro tera program 😂

  • @sebinjoseph1365
    @sebinjoseph1365 2 หลายเดือนก่อน +1

    this is wrong code,the correct code is
    #include
    int main() {
    int a, b, c;
    printf("Enter 3 numbers to compare: ");
    scanf("%d%d%d", &a, &b, &c);
    if (a >= b && a >= c) {
    printf("%d, a is the greatest
    ", a);
    } else if (b >= a && b >= c) {
    printf("%d, b is the greatest
    ", b);
    } else {
    printf("%d, c is the greatest
    ", c);
    }
    return 0;
    }