Q. Write a nested single symbol pyramid C program as:
#
#
##
##
###
###
####
####
Ans.
/*c program for nested single symbol pyramid*/
#include<stdio.h>
int main()
{
int num,r,c,z;
printf("Enter Maximum Loop Repeat Number: ");
scanf("%d", &num);
for(r=1; r<=num; r++)
{
for(c=1; c<=2; c++)
{
for(z=1; z<=r; z++)
printf("#");
printf("\n");
}
}
getch();
return 0;
}
/****************************************
The output of above program would be
****************************************/
Related Programs:
#
#
##
##
###
###
####
####
Ans.
/*c program for nested single symbol pyramid*/
#include<stdio.h>
int main()
{
int num,r,c,z;
printf("Enter Maximum Loop Repeat Number: ");
scanf("%d", &num);
for(r=1; r<=num; r++)
{
for(c=1; c<=2; c++)
{
for(z=1; z<=r; z++)
printf("#");
printf("\n");
}
}
getch();
return 0;
}
/****************************************
The output of above program would be
****************************************/
Figure: Screen shot for nested Single Symbol Pyramid C program |
Related Programs:
Since this was relinked again on g+...
ReplyDeletehttps://gist.github.com/mar77i/9782405
can you spot which version is better?