DexTexMex
asked on
C programming
Hi i'm new to C programming and need some help with writing a program.
Im trying to write a program that will read 3 numbers from the keyboard and print the largest one on the screen.
I have to only use 2 variables, 1 to read the numbers and one to hold the highest value.
I would be most grateful for any help
Im trying to write a program that will read 3 numbers from the keyboard and print the largest one on the screen.
I have to only use 2 variables, 1 to read the numbers and one to hold the highest value.
I would be most grateful for any help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#include <stdio.h>
#include <conio.h>
void main(){
int Num=0, nVal;
printf("Enter three numbers followed by return. 0 to END\n");
do{
scanf("%d",&nVal);
if(nVal > Num)
{
Num = nVal;
}
}while(nVal != 0 );
printf("The largest number is : %d",Num);
getche();
}