Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  question_2.a.exe
Language: C/C++
Code:
#include<stdio.h>
int main()
{
    int i,j,n;
    printf("How many lines you want to print: ");
    scanf("%d",&n);
    for(i=0; i<n; ++i)
    {
        for(int k=i+1; k<n; ++k) printf(" ");
        for(j=0; j<2*i+1; ++j)
        {
            if(j%2==0) printf("%d",i);
            else printf("*");
        }printf("\n");
    }
}
          
Comments: