Code:
#include<iostream>
using namespace std;
zoom(int x)
{
if(x<=1)
return 0;
else
{
return x+zoom(x-1);
}
}
main()
{
cout<<"\t\t*********Sum with recartion***********\n\n";
int c;
cout<<"Enter Data:";
for(int z=0;z<5;z++)
{
cin>>c;
cout<<"\t ";
}
//
cout<<"\n\nSum\t"<<zoom(c);
}
0 Comments