| | |
Hi, would you mind helping me with my homework?
![]() |
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
Hi, I have a homework assignment that is giving me some problems. I need to make a pyramid of * with a spaces and n rows long. It should look something like this:
____*
___* *
__* * *
_* * * *
* * * * *
I have most of it but my compiler is still coming up with errors. Please help.
____*
___* *
__* * *
_* * * *
* * * * *
I have most of it but my compiler is still coming up with errors. Please help.
C Syntax (Toggle Plain Text)
# include <stdio.h> #include <stdlib.h> int main (void) { int n; for (int i=0; i<n; i++); { for (int j=0; j<n-1-i; j++); printf (" "); } { for (int k=0; k<(2*(i+1));k++) printf ("* "); } printf ("\n"); system ("PAUSE"); return 0; }
Last edited by morning_star_18; Oct 17th, 2006 at 2:14 am.
#include <stdio.h> // There should be no spaces between # and include #include <stdlib.h> int main (void) { int n = 9; // initialize n to the value you want for (int i=0; i<n; i++) // deleted the semicolon { // You print spaces until n - 1 - i for (int j=0; j<n-1-i; j++) // deleted the semicolon printf (" "); // After printing spaces print * until n for (int k=n-1-i; k<n;k++) printf ("* "); printf ("\n"); } system ("PAUSE"); // use cin.get() or something return 0; }
バルサミコ酢やっぱいらへんで
![]() |
Similar Threads
- Need Help on other homework (Computer Science)
- Assistance with change program (C++)
- Average of prime number between 1 & 100 (C#)
- Help!!!!!! (C++)
- I Need Help!! (Java)
- Beginner Networking (Networking Hardware Configuration)
- Translate an algorithm to C program (C)
Other Threads in the C Forum
- Previous Thread: round off number
- Next Thread: Console Programming
| Thread Tools | Search this Thread |
#include * ansi array arrays asterisks binarysearch calculate centimeter changingto char character convert copyanyfile copyimagefile copypdffile creafecopyofanytypeoffileinc createprocess() database dynamic execv fflush fgets file floatingpointvalidation fork forloop function getlogicaldrivestrin givemetehcodez grade gtkwinlinux histogram homework i/o ide inches include infiniteloop input interest intmain() iso keyboard km license linked linkedlist linux list looping lowest matrix meter microsoft mysql number oddnumber open opendocumentformat openwebfoundation pdf pointer posix power probleminc process program programming pyramidusingturboccodes radix read recursion recv recvblocked research reversing scheduling segmentationfault send sequential single socket socketprogramming stack standard strchr string suggestions systemcall test threads turboc unix urboc user variable whythiscodecausesegmentationfault win32api windowsapi






