Write a C++ program without using any loop (if, for, while
etc) to print numbers from 1 to 100 and 100 to 1;
Answer Posted / ajeet kumar
#include<stdio.h>
#include<conio.h>
int f(int);
void main()
{
static int n=0;
n++>99 ? 0 : f(n) ; //its value are not used.
}
int f(int n)
{
printf(" %d",n);
main();
printf(" %d",n--); //]internally stack is ctr
return(1);
} /* run firstly,after press alt+F5.
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What is bash c?
Where local variables are stored in c?
How can type-insensitive macros be created?
What is the difference between scanf and fscanf?
What is difference between array and pointer in c?
Explain the concept and use of type void.
Can a pointer be null?
What is structure of c program?
Do you know what are the properties of union in c?
how is the examination pattern?
What is clrscr ()?
Write a program in c to replace any vowel in a string with z?
If null and 0 are equivalent as null pointer constants, which should I use?
What is 1d array in c?
what is ur strangth & weekness