Why are you writing this line largest = nvalue;
?
And your if-else if commands are totally wrong.
Try this code:
#include <stdio.h>
int main(){
int largest = 0;
int no1, no2, no3;
printf("Number1: ");
scanf("%d", &no1);
printf("Number2: ");
scanf("%d", &no2);
printf("Number3: ");
scanf("%d", &no3);
if ((no1 > no2) && (no1>no3)){
largest=no1;
}
else if ((no2 > no1) && (no2>no3)) {
largest=no2;
}
else {
largest=no3;
}
printf("The largest number is:%d", largest);
return 0;
}
4
solved C Program not working