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...

how to print
1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1
using any loop(for or while) only once(only 1 loop) and
maximum 2 variables using C.

Answer Posted / taizul

#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
for(int i = 1; i < 20; i++){
if(i>=10){
printf("%d ",(10-(i%10)));

}
else{
printf("%d ",i);
}

}
return 0;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2910


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

950


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1582


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

3180


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

2436


how to test pierrot divisor

2722


What is full form of PEPSI

2372


Cluster head selection in Wireless Sensor Network using C programming language.

3689


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3602


Write a program to model an exploding firecracker in the xy plane using a particle system

4101


write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

2649


why nlogn is the lower limit of any sort algorithm?

2793


Develop a routine to reflect an object about an arbitrarily selected plane

3556


write a program for area of circumference of shapes

2513


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

2727