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 difference between scanf and gets?
Explain what is the difference between far and near ?
How can I recover the file name given an open stream?
using for loop sum 2 number of any 4 digit number in c language
Why do we use int main instead of void main in c?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
What is the difference between text files and binary files?
What is #line used for?
Is c dynamically typed?
What is operator promotion?
What is a header file?
What are c identifiers?
What is pointers in c with example?
swap 2 numbers without using third variable?
Is null a keyword in c?