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

Explain continue keyword in c

1017


How can I generate floating-point random numbers?

1126


hi, which software companys will take,if d candidate's % is jst 55%?

2091


Explain how can you be sure that a program follows the ansi c standard?

1471


Is there a built-in function in C that can be used for sorting data?

1250


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2050


how to build a exercise findig min number of e heap with list imlemented?

2074


Explain the difference between call by value and call by reference in c language?

1108


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

1284


Does free set pointer to null?

1001


What is a file descriptor in c?

1126


Write a program to check whether a number is prime or not using c?

1054


What are the two forms of #include directive?

1160


What is this pointer in c plus plus?

1082


Why we use int main and void main?

1072