Code Scrappers


Greatest Of three numbers C program


              #include<stdio.h>
              #include<stdlib.h>

              void main()
              {
                  int x, y, z;

                  printf("Enter value of x: \n");

                  scanf("%d",&x);

                  printf("Enter value of y: \n");

                  scanf("%d",&y);

                  printf("Enter value of z: \n");

                  scanf("%d",&z);

                  if ((x > y) && (x > z))
                  {
                      printf("x is greatest\n");
                  }

                  else if ((y > z) && (y > x))
                  {
                      printf("y is greatest\n");
                  }
                  else if ((z > x) && (z > y))
                  {
                      printf("z is greatest\n");
                  }

              }


          



Output

    Enter value of x:
    2
    Enter value of y:
    4
    Enter value of z:
    6
    z is greatest