Posts

Showing posts with the label Patterns

Important patterns for IPLC Practical exam with solution

1)Write a program to print following pyramid.  *  * *  * * *  * * * * Ans : #include<stdio.h> #include<conio.h> void main() { int num,row,col,space; clrscr(); printf("Enter a num = "); scanf("%d",&num); for(row=1;row<num;row++) { for(space=num-1;space>row;space--) { printf(" "); } for(col=1;col<=row;col++) { printf(" *"); } printf("\n"); }          gotoxy(60,20);     //this is optional part printf("By Aaftab");//this is optional part         getch(); } 2)Write a program that accepts an integer N, if the integer N = 4,then print the pyramid :  1  121  12321  1234321 Ans : #include<stdio.h> #include<conio.h> void main() { int row,col,k,num,a,b,c; clrscr(); printf("Enter a num = "); scanf("%d",&num); for(row=1;row<num;row++) { for(col=1;col<=row;col++) { printf("%d",col)...