1 like 0 dislike

Use the pointers p1, p2, and p3 and complete the following program to read two integers and display the sum of the integers between them. For example, if the user enters 6 and 10, the program should display 24 (7+8+9). The program should force the user to enter numbers less than 100 (<100) or greater than 0 (>0) and the first integer should be less than the second, else display "Invalid value".

Sample Input 1:

6 10

Sample Output 1:

24


Sample Input 2:

10 6

Sample Output 2:

Invalid value

 

[Exercise] Coding (C) - asked in C
Available when: Unlimited - Due to: Unlimited
| 329 views
0 0
Called for Help

58 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

int main(void)

{
** * * * ** * * ** a,b,i,sum=0;


* *** * * * ** * ***** ***** * ** ** * **


* ****** ** * *** ** ** *
* * *** ** * * **** *
* * **** * * ** * * * **** * **** * ** * *** * ** **
* ** *** * *** **** * * * * * ** * ***** *
* * ** * * **** **** * * * ***** * * * * * ******* ***** * * * **
**** **** * ** * *** * * ** *** * * * * * *
* * * * * * ** *** * *** * * * *** * * **** * * *** * ** * ** * *

    }
**** * * ** ** *** *
** * * ** * * ** ** *
*** ** **** ** *** * * * * ** * * * *** ** ** * ** *** * value");

    }

}
answered by (-324 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main(void)

{
***** ** *** * ** * ** * * a,b,i,sum=0;


* ** **** *** * * *** * * * * * * **** **** * * * *


******* * ** * *** ** *** ***
* * * * *****
* ***** **** * * * * * ** * *** ********* ** * **** * * *
* ** ** ***** *** **** ** * *** * *** *** * *
* *** **** * **** * ** * ** ** * ** * ** ** * ** * * *
* ** * ** *** ** ** ** * * * * * *
* * ** *** * * * ** * *** ****** ** ** **** ** *** * * ** * *

    }
* * ****** ** * *** * * *
* ** * ** * ** * * * *
* * ** * ** ** * * ** * * ** ****** * ** * * * * * *** value");

    }

}
answered by (-324 points)
0 like 0 dislike
Hidden content!
#include * *** ** ****

#include ***** * *** *



int main()

{
*** ****** * * * ** ** n1, n2, *ptr1, *ptr2, *ptr3, i, sum=0;


* ** * ** ** * * = &n1;
* ** * **** * ** * = &n2;
*** * * * * * * = *** *


** * * ***** * ** ***** *** **** * * ** ** ptr1, ptr2);
* * * ** **** ** * * *** < n2 * * ** *** n1 > 0 * * * n2 < 100)
**** * ** ** * *****
* * **** ** * * **** * * ** **** ** *** ***** * *** * i<n2; i++)
* ** ***** ** * * ** ** *** *** += i;


* * * * *** *** ** ****** **** ** *ptr3);
* *** ** ** * * *
* * ** * * * *
****** * * * ** * * * ** ***** ** **** * * ** ** * * ***** * ** ***


** **** * ***** * ** * * 0;

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include * * * ****



int main()

{
* * **** ** * * ** * n1, n2, *ptr1, *ptr2, i, sum=0;


******* * ** * ** * *** = &n1;
* * *** **** * *** ** = &n2;


* ** * ****** ** ** * ** (1)
* * * ** * ** *** * *
*** *** * * * * * ***** * * * * ***** * ******* %d", ptr1, ptr2);
**** *** ****** ** * ** * * * * ** **** * < n2 && n1 > 0 && n2 < 100)
** ** * * ** **** *** * ***** * **** ** * * * ** * * * * * * * *****
** ** *** * * **** ** ** ** * ** *** * ** ***
* * * *** * * * * ** *** ******* * *
** *** * * * ** * * * ****** *** * * ** ** ** * ** * **** * * ** *** ****** * * * * ** value");
* * ** ***** ** *** * *** * * **** ***** ****** * ** ****** * * **
** * * ** * * ******* * **** * * * * *
* ** *** * * * **


**** * ** * ** ** ****** *** i<n2; i++)
** * * * * ** * ** * ***** **** * * * += i;


** * * * *** ** * *** ******** * *** ** sum);


* * ** ** * * * * ** ** ** 0;

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include ** * * * *

#include ** ***



int main()

{
* ** * **** * * ** ** n1, n2, *ptr1, *ptr2, i, sum=0;


*** *********** * * * ** = &n1;
* * * * * * ** * = &n2;


* ****** * * * * ** (1)
* *** **** ** * * * ***
* ***** * * *** * ** ** * *** *** **** * ** *** * * * %d", ptr1, ptr2);
* * * * *** ****** ** * * * ** ** * * < n2 && n1 > 0 ** *** n2 < 100)
* ** ** ** **** ** * * * ******** *** * * * * * * * **** ** *******
* *** ** * * * * *** * * * * * * * *****
*** ** **** **** ** **** *** ** * * *** * ***** * ******* ** * * * ** * ** value");
* ** * * * * * **** *** * * *** *


* * * * * *** * * * **** * i<n2; i++)
* * ** * * * **** * * * ** * ** * * ** ** ** += i;


* * * ** * *** * sum);


* * * * ** ** ** 0;

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include ** * ***

#include ** ** * * *



int main()

{
** * ** *** ** * ** **** n1, n2, *ptr1, *ptr2, i, sum=0;


** ** * * * * ** *** = &n1;
* * ***** ** * = &n2;


* * ** * *** ** **** ** (1)
* * ** * * * *
*** *** * * ******** ** ** ** * ** ***** *** ** ** * * %d", ptr1, ptr2);
* ***** ** **** * ** ** ** * ** * ** *** * ** ** < n2 && n1 > 0 * * ** * * n2 < 100)
****** ** **** * * ******* ** *** ** ** **** * * * * ** ***** **
* * *** **** *** * * **** * *** ** ** * * *
** ** * *** * ** ** ** * * ** * * * ** *** ** ** ** * ** * * ** * ********* value");
* ** * * * ** *


*** ** *** **** ** * ** * * ** i<n2; i++)
** ** **** * * ** * * *** * * * *** * ** * * += i;


** * * *** ** ***** * * **** * sum);


** ** * *** * ** * 0;

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include *** **

#include *** * ** ***



int main()

{
* *** * ** ** * ** n1, n2, *ptr1, *ptr2, i, sum=0;


* * ***** * ** * *** = &n1;
** * ** ** * * ***** ** * = &n2;


* * ****** ** * * ** * (1)
******** **** **** *
** * * **** ** * *** ** *** ******* * *** ** * * *** * * %d", ptr1, ptr2);
* * * * *** ** * ** ** *** ****** ** ** * * * < n2 && n1 > 0 * n2 < 100)
** ** ** * ** * ** ** ******* * * * ** ** * ** * * * * *
** * * ** * * * ** *** * ** * ****
* * *** * * * *** ** * **** * * * ** ** ** ** ** * * ** * * * * * ** value");
* *** *** ** * **


** *** ***** * ** i<n2; i++)
* ** ** * ******* ** * *** ** * * * * * * * * * += i;


* *** ** * ** * * *** *** * ** **** ** sum);


*** * *** ** * ***** * * * 0;

}
answered by (5.2k points)
0 like 0 dislike
Hidden content!
#include ** ****

#include * * * * *



int main()

{
**** **** ** **** * n1, n2, *ptr1, *ptr2, i, sum=0;


**** * *** * * ****** = &n1;
* * * * * * *** ** = &n2;


********* * ** * ** * * ** (1)
** ** ** * *** ** *** **
* ******* ** * * ** ** * ****** * * **** * * ** %d", ptr1, ptr2);
* ** ** * * ** *** ****** **** *** * < n2 && n1 > 0 * * *** ** n2 < 100)
**** * * * * * * * * * * ** *** * ** ** ** **** * * ** *
**** ** * * ** **** ** * ** **** **** * **** *
* ** * ** * * * ** *** ** * * * ** * **** * ***** *** ********* * *** * value");
* * *** *** * * * * *


*** **** * *** * **** * **** i<n2; i++)
** * * * ****** * ** * * ** * *** ** ** * * += i;


*** * **** * * ** * * ******** ** ** sum);


* **** * * * * *** 0;

}
answered by (5.2k points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.158.186.138
©2016-2020

Related questions

0 like 0 dislike
87 answers
[Exercise] Coding (C) - asked Mar 2, 2017 in C
Available when: Unlimited - Due to: Unlimited
| 402 views
0 like 0 dislike
52 answers
[Exercise] Coding (C) - asked Feb 23, 2017 in C
Available when: Unlimited - Due to: Unlimited
| 315 views
10,728 questions
119,708 answers
110,434 comments
3,802 users