【C语言】不使用循环和推断语句,求出1-100之间全部数的和
//不使用循环和推断语句,求出1-100之间全部数的和 #include <stdio.h> int fun(int n, int *sum) { *sum = *sum + n; (n--) && (fun(n, sum)); return n; } int main() { int n = 100; int sum = 0; fun(n, &sum); printf("%d\n", sum); return 0; } <img src="//img-blog.csdn.net/20150630155401858?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZG91ZG91d2ExMjM0/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />