I'm writing a problem with while loop to receive 10 numbers from user input and find Largest value. It's very simple without any high technique.
I've written following code but cannot output correct number.
please help me!
CODE
#include <stdio.h>
#include <math.h>
int main()
{
int num=0;
int largest=0;
int seclargest=0;
int counter=0;
int abc=3;
while ( counter <= 3 ) // Begin 1st while loop
{
printf("Enter a number=");
scanf("%d",&num);
printf("\n");
if ( num > largest ) // Begin loop to determine the largest of 10 numbers entered by user from the keyboard
largest = num;
counter++;
}
printf("largest number is %d\n",&largest);
printf("largest number is %d",&seclargest);
printf("%d",&abc);
printf("\n");
return 0;
return 0;
}
edit: modified title ~ jayman9