How do I show this output using for loop statement?

1
23
345
4567

Thanks in advance :)

Recommended Answers

#include "stdio.h"

int main()
{
int i;
for (i=0; i<4; i++)
{
  switch(i){
    case 0:
      printf("1\n");
      break;
    case 1:
      printf("23\n");
      break;
    case 2:
      printf("345\n");
      break;
    case 3:
      printf("4567\n");
      break;
    default:
      break;}
}
return 0;
}
Jump to Post

All 4 Replies

#include "stdio.h"

int main()
{
int i;
for (i=0; i<4; i++)
{
  switch(i){
    case 0:
      printf("1\n");
      break;
    case 1:
      printf("23\n");
      break;
    case 2:
      printf("345\n");
      break;
    case 3:
      printf("4567\n");
      break;
    default:
      break;}
}
return 0;
}
commented: That's horrible! Excellent :) +17
commented: It's like a Microsoft answer - technically correct, but utterly useless. :P +2

1
1 2
2 3 4
3 4 5 6
4 5 6 7

plz submit code ..........plzzzzzzzzzzzzzzzzzzzzzz

I looked up the word "plz" in the dictionary and it does not exist, especially not one with that many letter "Z"s.

Note that the question in this thread has already been answered 2 years ago. Why can't you use that code as a starting point?

    **********
     *********
      ********
       *******
        ******
         *****
          ****
           ***
            **
             *


     plz send the code this diagram........
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.