#include int main() { int i; extern int formula1(int n), formula2(int n); for (i = 1; i <= 100; i++) if (formula1(i) != formula2(i)) printf("formula doesn't work for n=%d\n", i); return 0; } int formula1(int n) { int i, sum; sum = 0; for (i = 1; i <= n; i++) sum = sum + i; return sum; } int formula2(int n) { return (n * n + n) / 2; }