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 the difference between struct and typedef struct in c?
How variables are declared in c?
What is int main () in c?
Explain the difference between exit() and _exit() function?
What is structure in c language?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What is the general form of function in c?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
How do I create a directory? How do I remove a directory (and its contents)?
What are the types of assignment statements?
What is meant by inheritance?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What are the 5 elements of structure?
Why is not a pointer null after calling free?
Differentiate Source Codes from Object Codes