Write a C program that reads a number from a file namedinput.txt and prints the
ID: 3611039 • Letter: W
Question
Write a C program that reads a number from a file namedinput.txt and prints the number followed by "is positive", "isnegative", or "is zero" depending on the value read in. The programmust read as many numbers as there are in the file. Write theprogram and test it. Write a C program that reads a number from a file namedinput.txt and prints the number followed by "is positive", "isnegative", or "is zero" depending on the value read in. The programmust read as many numbers as there are in the file. Write theprogram and test it.Explanation / Answer
please rate - thanks #include #include main() { int num; FILE *fp; if(!(fp=fopen("input.txt","r"))) { printf(" Error opening file "); getch(); return 1; } while(fscanf(fp,"%d",&num)!=EOF) {if(num>0) printf("%dpositive ",num); else if (numRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.