Advertisement
seergiomv

Ejercicio 12.3

Dec 9th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.22 KB | None | 0 0
  1. #include <stdio.h>
  2. suma(int n){
  3.     int sum = 0;
  4.     for (int i = 1; i <= n; i++){
  5.         sum = sum+i;
  6.     } printf("%d",sum);
  7. }
  8. int main(){
  9.     int n,sum;
  10.     printf("Dame n: ");
  11.     scanf("%d",&n);
  12.     suma(n);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement