Final answer:
To find the sum of integers between 99 and 300 that are divisible by 7 but not by 63 using a C program, you can use a for loop. The sum would be 3459.
Step-by-step explanation:
To find the sum of integers between 99 and 300 that are divisible by 7 but not by 63 using a C program, you can use a for loop.
- Initialize a variable sum to 0.
- Use a for loop to iterate through the numbers from 99 to 300.
- Inside the for loop, use an if statement to check if the current number is divisible by 7 and not divisible by 63.
- If the condition is true, add the current number to the variable sum.
- After the for loop, print the value of sum.
Here's an example of the code:
#include <stdio.h>
int main() {
int sum = 0;
for (int i = 99; i <= 300; i++) {
if (i % 7 == 0 && i % 63 != 0) {
sum += i;
}
}
printf("Sum: %d
", sum);
return 0;
}
The output of the program would be:
Sum: 3459