How to add first 20 numbers without using any loop in C?

#include<stdio.h>
int main()
{
    int a=20,sum;

        sum=add(a);
        printf("%d", sum);

}
int add(int n)
{
    if(n==1)
            return 1;
        else
            return(n+add(n-1));
}

Advertisements

#c