Find the greater value | C

*Take 3 values from user and find the greater value among them.
Solution:

#include <stdio.h>

int main() {
    int a,b,c;
    printf("Press 1st value:\n");
    scanf("%d",&a);
    printf("Press 2nd value:\n");
    scanf("%d",&b);
    printf("Press 3rd value:\n");
    scanf("%d",&c);
    if(a>b && a>c){
        printf("Your Greater Value is: %d\n",a);
    }
    else if(b>a && b>c){
        printf("Your Greater Value is: %d\n",b);
    }
    else printf("Your Greater Value is: %d\n",c);
    return 0;
}

Post a Comment

Post a Comment (0)

Previous Post Next Post