Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What are the errors of this input?

Eifa BellaEifa Bella Member Posts: 1

include<stdio.h>

include<conio.h>

int main()
{
int i=1;
float num, average, sum;

printf("Maximum num of inputs: ");
scanf("%f",i);
for(i=1;i>=1;++i); 
{
    printf("Enter &f\n: ",i);
    scanf("%f",&i);
    goto
    sum=+num;
}
jump:
    average=sum/(i-1);
    printf("Average: %.2f",i);
    getch ();
    return 0;

}

Tagged:

Comments

  • B00B00 Member Posts: 104 ✭✭✭

    What's the point of reading value of i if you reset it back to 1 in for loop. On top of that you reset it every cycle inside the loop thus creating infinite loop unless user enters 0. Your whole code revolves around single variable i.
    Also WTF is this goto?
    I'd suggest you start over.

Sign In or Register to comment.