This repository has been archived on 2019-08-09. You can view files and clone it, but cannot push or open issues or pull requests.
s4-c/DS1/E1-1.c

24 lines
439 B
C
Raw Normal View History

2016-03-16 09:51:20 +01:00
/* Nombre triangulaire */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
int n, i, j, T = 0;
printf("Saisissez n : ");
scanf("%d", &n);
for (i = 1; i <= n; i++) {
for (j = 1; j <= i; j++) {
printf("*");
T += 1;
}
printf("\n");
}
// printf("T_%d = %d\n", n, n*(n+1)/2);
printf("T_%d = %d\n", n, T);
return 0;
}