Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void conta (int a, int b, int *tot);
- int main ()
- {
- int a, b, tot=0;
- for (;;)
- {
- scanf("%d %d", &a, &b);
- if (a<=b&&a>0&&b>0)
- {
- conta(a, b, &tot);
- break;
- }
- }
- printf("%d", tot);
- }
- void conta (int a, int b, int *tot)
- {
- int i;
- for (i=a; i<=b; i++)
- {
- *tot+=i;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement