C program to print square spiral number pattern - asr
#include <stdio.h>
#include <conio.h>
void main(){
int i,j,a[10],n=3,big,k;
clrscr();
printf("enter three numbers\n ");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("\n");
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
i>1&&i<5&&j>1&&j<5?i==3&&j==3?
printf("%d ",a[0]):
printf("%d ",a[1]):
printf("%d ",a[2]);
}
printf("\n");
}
getch();
}
output:
#include <conio.h>
void main(){
int i,j,a[10],n=3,big,k;
clrscr();
printf("enter three numbers\n ");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("\n");
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
i>1&&i<5&&j>1&&j<5?i==3&&j==3?
printf("%d ",a[0]):
printf("%d ",a[1]):
printf("%d ",a[2]);
}
printf("\n");
}
getch();
}
output:
Comments
Post a Comment