Tutorial 4_Q1

Print the following shapes using loop construct of C programming. 


*
* *                                                                                                                next
* * *
* * * *
* * * * *
* * * * * *

Answer

#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=6;i++)
{
  for(j=1;j<=i;j++)
{
printf("* ");
}
printf("\n");    
}
       return 0;
}          
                  







0 comments:

Post a Comment