Asked by Tracy
#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....
#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....
Answers
Answered by
Tracy
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);
For(i=0;i<n;i++)
printf("%d ",num[i]);
printf("\n");
system("pause");
return 0;
}
Answered by
Writeacher
Assistance needed.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.