#include<conio.h>
#include<stdio.h>
int sumseries(int n)
{
int sum=0;
if(n==0)
return 0;
return (n+sumseries(n-1));
}
void printseries(int n)
{
if(n==0)
return 0;
else
printf("% d",n);
printseries(n-1);
}
void main()
{
int num;
clrscr();
printf("Enter The No. Of Elements Of The Series : ");
scanf("%d",&num);
printseries(num);
printf("\n\nPrinting Sum : %d",sumseries(num));
getch();
}
#include<stdio.h>
int sumseries(int n)
{
int sum=0;
if(n==0)
return 0;
return (n+sumseries(n-1));
}
void printseries(int n)
{
if(n==0)
return 0;
else
printf("% d",n);
printseries(n-1);
}
void main()
{
int num;
clrscr();
printf("Enter The No. Of Elements Of The Series : ");
scanf("%d",&num);
printseries(num);
printf("\n\nPrinting Sum : %d",sumseries(num));
getch();
}
0 comments:
Post a Comment