Skip to main content

Posts

Showing posts with the label Pattern

Print Pattern 5 

#include <stdio.h> void main() { int i, j, k; for(i=5;i>=1;i--) { for(k=5;k>=i;k--) { printf(" "); } for(j=1;j<i;j++) { printf("*"); } printf("\n"); } getch(); } Output   Print   Download Code Output **** *** ** *

Print Pattern 4 

#include <stdio.h> void main() { int i, j, k; for(i=5;i>=1;i--) { for(j=1;j<=i;j++) printf("*"); printf("\n"); } getch(); } Output   Print   Download Code Output ***** **** *** ** *

Print Pattern 3 

#include <stdio.h> void main() { int i, j, k; for(i=5;i>=1;i--) { for(j=1;j<i;j++) { printf(" "); } for(k=5;k>=i;k--) { printf("*"); } printf("\n"); } getch(); } Output   Print   Download Code Output * ** *** **** *****

Print Pattern 2 

#include <stdio.h> void main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } getch(); } Output   Print   Download Code Output * ** *** **** *****

Print Pattern 1 

#include<stdio.h> int main() { int num,r,c; printf("Enter number of rows/columns: "); scanf("%d",&num); for(r=1; r<=num; r++) { for(c=1; c<=num; c++) printf("* "); printf("\n"); } getch(); return 0; } Output   Print   Download Code Output Enter number of rows/columns: 5 * * * * * * * * * * * * * * * * * * * * * * * * *