Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / ravi sagar

#include<stdio.h>
#include<conio.h>

void main()
{
clrscr();
int i;
int j=100;
int c=0;
printf("1 to 100 then 99 to 1");
for(i=1;i<=100;i++;)
{ if (c==0)
{
printf("%d",i);
if(i==100)
{
c=1;
}
}
if(c==1)
{
j--;
printf("%d",j);
if(j==0)
{
break;
}
}
}

Is This Answer Correct ?    4 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a code of a general series where the next element is the sum of last k terms.

1092


What is the purpose of clrscr () printf () and getch ()?

1112


What will be the outcome of the following conditional statement if the value of variable s is 10?

1370


What is the use of extern in c?

1147


What is C language ?

2018


Why doesnt that code work?

1277


What is struct node in c?

1125


What is the maximum no. of arguments that can be given in a command line in C.?

1201


What are keywords c?

1092


What is return in c programming?

1022


Write a program to print factorial of given number using recursion?

1064


Explain argument and its types.

1114


An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?

1294


Differentiate fundamental data types and derived data types in C.

1090


What is the difference between near, far and huge pointers?

1155