Write an interactive program that asks the user to supply threeintegers k,m,and
ID: 3616729 • Letter: W
Question
Write an interactive program that asks the user to supply threeintegers k,m,and n with k being greater than one. Your programshould compute the sum of all the integers between m and n that aredivisible by k.Here is my code so far.. Can someone show me where I'm going wrongor correct it?
#include <stdio.h>
int main(void)
{
int k, m, n, sum=0,i;
printf(" Please enter aninteger ");
scanf("%d", &n);
printf(" Please enteranother intger ");
scanf("%d", &m);
printf(" Please enter aninteger greater than one")'
scanf("%d", %k);
for (k >1 ; n < i < m, ++i)
{
sum= sum + (i/k)
}
printf("sum= %d ", sum);
return 0;
}
Explanation / Answer
int main(void) { int k, m, n, i; printf(" Please enter aninteger "); scanf("%d", &n); printf(" Please enteranother intger "); scanf("%d", &m); printf(" Please enter aninteger greater than one")' scanf("%d", %k); for(i = m; iRelated 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.