Computer Science, asked by ShubhamKumar1357, 1 year ago

Write a program to print a pattern by using 2 loop in computer
Pattern is
1 3 5 7 9
3 5 7 9 1
5 7 9 1 2
7 9 1 3 5
9 1 3 5 7

Answers

Answered by Anonymous
3
ANSWER
.........
#include <stdio.h>



#include <conio.h>



void main() {



int i,j,k,samp=1;



clrscr();


for (i=1; i<=5; i++) {




for (k=samp; k<=5; k++) {



printf(" ");



for (j=0; j< i; j++) {



printf("*");




}
samp = samp + 1;




printf("\n");
}
samp = 1;



for (i=4; i>=1; i--) {



for (k=samp; k>=0; k--) {



printf(" ");
}
for (j=i; j>=1; j--) {



printf("*");
}
samp = samp + 1;


printf("\n");



}
getch();



Similar questions