QUESTION
You’re given an even number n. If n=4, you have to print the following pattern :4444
4334
4334
4444
If n=6, then the pattern should be like this :
666666
655556
654456
654456
655556
666666
PROGRAM :
#include <stdio.h>
#include<stdlib.h>
int main() {
int a,i,j,k,l,m;
scanf("%d",&a);
k=a;
for(i=1;i<=a;i++)
{
l=a;
m=k+1;
for(j=1;j<=a;j++)
{
if((j>=i && j<=(a-i+1)&& i<=(a/2)) || (j>=(a-i+1) && j<=i && i>(a/2)))
{
printf("%d",k);
}
else if(j<i)
{
printf("%d",l);
l--;
}
else
{
printf("%d",m);
m++;
}
}
if(i<(a/2))
k--;
if(i>(a/2))
k++;
printf("\n");
}
}
#include<stdlib.h>
int main() {
int a,i,j,k,l,m;
scanf("%d",&a);
k=a;
for(i=1;i<=a;i++)
{
l=a;
m=k+1;
for(j=1;j<=a;j++)
{
if((j>=i && j<=(a-i+1)&& i<=(a/2)) || (j>=(a-i+1) && j<=i && i>(a/2)))
{
printf("%d",k);
}
else if(j<i)
{
printf("%d",l);
l--;
}
else
{
printf("%d",m);
m++;
}
}
if(i<(a/2))
k--;
if(i>(a/2))
k++;
printf("\n");
}
}
Martocepho Hoi Richter https://marketplace.visualstudio.com/items?itemName=ryonaepepwa.TheDark-gratuita-2022
ReplyDeletegaradeso
torcaKgrese Sarah Walker Download
ReplyDeletestigbabnace
tremimQcrysko-Billings Sarah Walker Movavi Video Converter
ReplyDeleteBandicam
Kaspersky Total Security
titagrennti
MlatdiYcoc_pa Jamie Smith program
ReplyDeletePrograms
hotlisere