#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int i,j,sp,n;

printf(“enter the no::”);

scanf(“%d”,&n);

sp=n-1;
for(i=1;i<=n;i++)

{

for(j=1;j<=sp;j++)

{

printf(” “);

}

for(j=i;j>=1;j–)

{

printf(“%d”,j);

}

for(j=2;j<=i;j++)

{

printf(“%d”,j);

}

printf(“\n”);

sp–;

}

sp=n+1-5;
for(i=n-1;i>=1;i–)

{

for(j=1;j<=sp;j++)

{

printf(” “);

}

for(j=i;j>=1;j–)

{

printf(“%d”,j);

}

for(j=2;j<=i;j++)

{

printf(“%d”,j);

}

printf(“\n”);

sp++;

}
getch();

}

No tags Hide

/*123454321

2345432

34543

454

5*/

#include<stdio.h>

#include<conio.h>
void main()

{

clrscr();

int i,j,sp,n;

printf(“enter the no::”);

scanf("%d",&n);

sp=n+1;

for(i=1;i<=n;i++)

{

for(j=1;j<=sp;j++)

{

printf(” “);

}

for(j=i;j<=n;j++)

{

printf(“%d”,j);

}

for(j=n-1;j>=i;j–)

{

printf(“%d”,j);

}

printf(“\n”);

sp++;

}

getch();

}

No tags Hide

/*      1

121

12321

1234321

123454321*/
#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int i,j,sp,n;

printf(“enter the no::”);

scanf(“%d”,&n);

sp=n-1;

for(i=1;i<=n;i++)

{

for(j=1;j<=sp;j++)

{

printf(” “);

}

for(j=i;j>=1;j–)

{

printf(“%d”,j);

}

for(j=2;j<=i;j++)

{

printf(“%d”,j);

}

printf(“\n”); sp–;

}

getch();

}

No tags Hide

/*1

12

123

1234

12345  */

#include<stdio.h>

#include<conio.h>
void main()

{

clrscr();

int n;

printf(“enter the value::”);

scanf(“%d”,&n);

int i;

int j;

for(i=1;i<=n;i++)

{

for(j=1;j<=i;j++)

{

printf(“%d”, j);

}

printf(“\n”);

}

getch();

}

No tags Hide

#include<stdio.h>

#include<conio.h>
void main()

{

clrscr();

int num,i,count;

for(num=1;num<=100;num++)

{

count=0;
for(i=2;i<=num/2;i++)

{

if(num%i==0)

{

count++;

}

}

if(count==0 && num!=1)
printf(“%d\t”,num); }

getch();

}

No tags Hide

Next »

Managed by

MNP INFOTECH