This is to be written in C programming. I need help with the code for adding the
ID: 2084010 • Letter: T
Question
This is to be written in C programming. I need help with the code for adding the numbers between the small and large value entered.
Write a program that takes two integers, a small and a large integer, and adds all the numbers between them. If the "small' value is larger than the "large' value, the program should print an error message. This is a sample output. The program adds the numbers: 4+5+6+7+8 30. Enter a small value 4 Enter a large value 8 The sum of integers between 4 and 8 is: 30 Enter a small value 12 Enter a large value 6 Invalid inputExplanation / Answer
# include <stdio.h>
void main()
int s , l, i:
{
printf("enter a number ", s);
scanf("%d",&s );
printf ("enter a number " , l)
scanf("%d",&l );
if (s < l)
for(i=s; i<=l ; i++ )
s = s ++;
else if(s>l)
printf("Invalid input");
}
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.