repl.it
@maniero/

ForInit

C

No description

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

int soma(int n1, int n2) {
    int soma = 0;
    for (int i = n1; i < n2; i++) soma += i; 
    return soma; 
}
int main() {
    int a, b; 
    printf("Digite dois numeros:");
    scanf("%d %d",&a,&b);
    printf("\nSoma = %d", soma(a, b));
}

//https://pt.stackoverflow.com/q/384958/101