Tuesday, March 5, 2024

1. Largest of 3 numbers using nested :—

 1. Largest of 3 numbers using nested :—


#include<stdio.h>

int main()

{

    int a,b,c;

    printf("enter 3 values ");

    scanf("%d%d%d",&a,&b,&c);

    if(a>=b)

    {

        if(a>=c)

        {

            printf("%d is the largest",a);

        }

        else

        {

            printf("%d is the largest",c);

        }

    }

    else

    {

        if(b>=c)

        {

            printf("%d is the largest",b);

        }

        else

        {

            printf("%d is the largest",c);

        }    

    }

    return 0;

}


No comments:

Post a Comment