-
-
Save programmingfaster0226/053b0939adc49ed391b183b448a39718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int sum(int); | |
void main() | |
{ | |
int s; | |
s=sum(50); | |
printf("the sum of first 50 natural numbers is %d",s); | |
getch(); | |
} | |
int sum(int x) | |
{ | |
if (x<1) | |
return 0; | |
else | |
return (x+sum(x-1)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment