My Math Forum C program , looping.

 Computer Science Computer Science Forum

 February 21st, 2013, 03:29 AM #1 Senior Member   Joined: Apr 2010 Posts: 128 Thanks: 0 C program , looping. Write a C program using pseudocode below :   1. Start 2. Ask user to enter a number from 1 to 9 or enter 0 to quit. 3. If user enter 0, goto line 4. If user enter number from 1 to 9 5. Display a box with row and columns using the number entered by user. (example if user enter 4, display box as below : 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6. Repeat line 2 7. End My work : #include main() { int integer; printf("Enter 1-9 to proceed , enter 0 to quit\n"); scanf("%d",&integer); if(integer<1) { return 0; } while(integer>9) { printf("Enter 1-9 to proceed , enter 0 to quit\n"); scanf("%d",&integer); } for(integer;integer>0;integer--) { {printf("%d",integer);} } return 0; } I can't even obtain one line of equal number....how to do it?
 February 24th, 2013, 06:52 AM #2 Member     Joined: Jul 2012 Posts: 60 Thanks: 0 Math Focus: Calculus Re: C program , looping. I'd imagine your program just prints out one line of numbers decresing in size Code: for(integer;integer>0;integer--) printf("%d",integer); All this does is it takes the number you enter, prints it to the screen, decreases it by 1, then prints it out again. You do not want to decrease the number at all. You want to print the same number in every loop. You need 2 for loops, and a counter. Code: for(int i=0; i
 February 25th, 2013, 04:23 AM #3 Math Team   Joined: Apr 2010 Posts: 2,780 Thanks: 361 Re: C program , looping. Or how about this? Code: for(int i=0; i
 February 27th, 2013, 08:01 AM #4 Senior Member   Joined: Apr 2010 Posts: 128 Thanks: 0 Re: C program , looping. Done! the X and Y variable had me struggled..... because i can only do one input. in the end i put x=integer , x<10 , x--

 Tags looping, program

### Factorial without using loop

Click on a term to search for related topics.
 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post Ayour Applied Math 0 February 28th, 2014 01:43 AM sdj Computer Science 1 December 13th, 2012 05:22 AM rage Academic Guidance 2 July 5th, 2012 07:51 AM Hoempa Computer Science 0 June 21st, 2010 05:37 AM Balawton Computer Science 10 January 22nd, 2010 09:38 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top