Sorry this is the one that I wrote with an error the first one is incorrect....
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num[100]={0};
int i,n=0;
for(i=0; num[i] != EOF ; i++,n++)
{
scanf("%d",&num[i]);
}
printf("%d\n", i);
For(i=0;i<n;i++)
printf("%d ",num[i]);
printf("\n");
system("pause");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num[100]={0};
int i,n=0;
for(i=0; num[i] != EOF ; i++,n++)
{
scanf("%d",&num[i]);
}
printf("%d\n", i);
while(i=0;i<n;i++)
printf("%d ",num[i]);
printf("\n");
system("pause");
return 0;
}
That's my code that I wrote and the input shoul be 123 ctrl z and the out output should be 3 but the code that I wrote if I wrote an input it gives me 107 output....Can anyone help me to figure out the problem....
2 answers
Assistance needed.