0

If \n is not there the program accepts 5 and if \n is used in scanning then the programs asks for 6 inputs.

#include<stdio.h>
int main()
{
    int marks[5];
    int i;
    for(i=0;i<5;i++)
    {
        scanf("%d\n",&marks[i]);

    }
    for(i=0;i<5;i++)
    {
        printf("the element at    %d is  %d\n",i,marks[i]);
    }
    return 0;
}
Justin
  • 24,288
  • 12
  • 92
  • 142

0 Answers0