Tuesday, April 10, 2012

failing to display array entered from keyboard in c

I'm new to c and I'm trying to write a c program that get 10 integer values entered from keyboard using scanf and then print them using printf but the result is not correct. Here is the code:



   #include<stdio.h>
#include<conio.h>
main(){
int x[10];
printf("\n\n\t\t PRGRAM THAT CAPTURES AND PRINTS 10 SCORES");
for(int i=1;i<=10;i++){
printf("\n\tEnter Score %d", i);
scanf("%d",x);
}
printf("\n\t The entered scores are: %d",x[i]);
return(0);
}


the output given is a four digit number like 8731 yet I expect something like 1234567890. some help please





No comments:

Post a Comment