By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,661 Members | 779 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,661 IT Pros & Developers. It's quick & easy.

Drawing an Inverted Triangle

P: 1
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  4. int main(int argc, char *argv[])
  5. {
  6.  int i=0, j;
  7.  while (++i<10) {
  8.        j=9;
  9.        while (++j<=i) {
  10.              printf("*");
  11.              }
  12.              printf("\n");
  13.              } 
  14.   system("PAUSE");    
  15.   return 0;
  16. }
Hey everyone, I am a newbie in C language and this is my first major obstacle in completing a tutorial in my preparatory course....I was experimenting with the code above to try to created an "inverted triangle" by using nested loop...This code was modified from the code given for creating a right-side up triangle...Anyone can show me how to do an "inverted triangle"? Also, I also don't understand what i and j exactly plays in the role in creating this triangular shape.
Aug 7 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 5,821
Heya, Geosondaman. Welcome to TSDN!

Changed thread title to better describe the problem (did you know that threads whose titles contain three words or less actually get FEWER responses?).

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

I'm going to go ahead and move this thread to the C forum, where our resident Experts will be better able to help you out.
Aug 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.