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 / shubham gupta
#include<stdio.h>
void fun(int n)
{
static int i=1,j;
printf("%d\n",i);
(100-i)?(i++?fun(n):0):exit(0);
}
int main()
{
int n;
n=100;
fun(n);
}
| Is This Answer Correct ? | 1 Yes | 7 No |
Post New Answer View All Answers
What is use of pointer?
What is the use of header files?
Write the syntax and purpose of a switch statement in C.
How are structure passing and returning implemented?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What is signed and unsigned?
Explain what is the benefit of using #define to declare a constant?
Give me the code of in-order recursive and non-recursive.
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
When is the “void” keyword used in a function?
What are dangling pointers in c?
What should malloc(0) do?
Explain how do you determine a file’s attributes?
Can a variable be both const and volatile?
For what purpose null pointer used?