Write a Program to Print vaue from 1 to N to 1 , without using loop ,
#include <stdio.h>
void Printfvalue(int value)
{
static int i=value;
static int j=1;
if((j )<( i))
{
printf("\n%d",j);
Printfvalue(++j);
printf("\n%d",--i);
}
else
{
printf("\n%d",j);
}
}
int main()
{
int nvalue;
printf("enter n Value -->> ");
scanf("%d",&nvalue);
Printfvalue(nvalue);
}
#include <stdio.h>
void Printfvalue(int value)
{
static int i=value;
static int j=1;
if((j )<( i))
{
printf("\n%d",j);
Printfvalue(++j);
printf("\n%d",--i);
}
else
{
printf("\n%d",j);
}
}
int main()
{
int nvalue;
printf("enter n Value -->> ");
scanf("%d",&nvalue);
Printfvalue(nvalue);
}
No comments:
Post a Comment