Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void printSequence(int n);
- int max(int a, int b);
- int main()
- {
- int n;
- printf("please enter an integer:");
- scanf("%d",&n);
- printSequence(n);
- }
- void printSequence(int n)
- {
- static int maxN = 0;
- maxN = max(n,maxN);
- if(n > 0)
- {
- printf("%d ",maxN-n+1);
- printSequence(n-1);
- return;
- }
- }
- int max(int a , int b)
- {
- if(a >= b)
- return a;
- return b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement