Computer Programming with Engineering Applications Assignment 4 1. (100 pts) Wri
ID: 641469 • Letter: C
Question
Explanation / Answer
#include "stdafx.h"
#include "stdio.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
int main(void)
{
int num, divider, counter = 0;
FILE * list;
FILE * output;
list = fopen("assign4.txt", "r");
output = fopen("output.txt", "w");
printf("Enter a number: ");
scanf("%d", ÷r);
while (fscanf(list, "%d", &num) != EOF)
{
if (num % divider == 0)
{
counter++;
fprintf(output, "%d ", num);
}
}
printf("%d numbers are divisible by %d ", counter, divider);
return 0;
}
assign4.txt
38
86
49
67
84
60
43
83
37
66
Related 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.