Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sum(int n){
- int total = 0;
- int i;
- for( i = 1 ; i <= n ; i++ ){
- total += i;
- }
- return total;
- }
- int main(){
- int a, b;
- scanf("%d%d", &a, &b);
- //int sumA = sum(a);
- // int sumA = sum(10) + 8 * 6;
- // int sumA = 55 + 8 * 6;
- //int sumB = sum(b);
- printf("sumA: %d\n", sum(a));
- printf("sumB: %d\n", sum(b));
- return 0;
- }
Add Comment
Please, Sign In to add comment