Sunday 7 September 2014

Printing Right Triangles

Level: Easy

You are given a positive integer N. You have to print N rows as follows. The first row consists of one 0, the second row 2 zeroes, and so on, until the Nth row, which consists of N zeroes.




program---



#include<stdio.h>

int main()
{int n,i,j;
scanf("%d",&n);


for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
printf("0");
printf("\n");
}return0;

}

No comments:

Post a Comment