1
22
333
4444
55555
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=1; j<=i; j++)
{
printf(“%d”, i);
}
printf(“\n”);
}
getch();
}
1
12
123
1234
12345
#include <stdio.h>
#include<conio.h>
Void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=1; j<=i; j++)
{
printf(“%d”, j);
}
printf(“\n”);
}
getch();
}
1
21
321
4321
54321
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=1; j<=i; j++)
{
printf(“%d”, (i+1)-j);
}
printf(“\n”);
}
getch();
}
55555
4444
333
22
1
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=1; j<=(6-i); j++)
{
printf(“%d”, (6-i) );
}
printf(“\n”);
}
getch();
}
54321
4321
321
21
1
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=(6-i); j>=1; j--)
{
printf(“%d”,j);
}
printf(“\n”);
}
getch();
}
6-
5
44
333
2222
11111
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j;
clrscr();
for (i=5; i>=1; i--)
{
for (j=5; j>=i; j--)
{
printf(“%d”, i);
}
printf(“\n”);
}
getch();
}
7 -
5
54
543
5432
54321
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j;
clrscr();
for (i=5; i>=1; i--)
{
for (j=5; j>=i; j--)
{
printf(“%d”, j);
}
printf(“\n”);
}
getch();
}
8 -
1
121
12321
1234321
123454321
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j, k, l;
clrscr();
for (i=1; i<=5; i++)
{
for (k=1; k<=5-i; k++)
{
printf(“%d”, (“ “);
}
for (j=1; j<=i; j++)
{
printf(“%d”, j);
}
for(i=i-1; i>=1; i--)
{
printf(“%d“, i);
}
printf(“\n”);
}
getch();
}
9 -
1
121
12321
1234321
123454321
1234321
12321
1
#include <stdio.h>
#include<conio.h>
Void main()
{
int i, j, k, l;
clrscr();
for (i=1; i<=5; i++)
{
for (k=1; k<=5-i; k++)
{
printf(“%d”, (“ “);
}
for (j=1; j<=i; j++)
{
printf(“%d”, j);
}
for(i=i-1; i>=1; i--)
{
printf(“%d“, i);
}
printf(“\n”);
}
for (i=1; i<=4; i++)
{
for (j=1; j<=i; j++)
{
Printf(“%d”, (“ “);
}
for (j=1; j<=5-1; j++)
{
printf(“%d“, j);
}
j=j-2;
for ( ; j>=1; j++)
{
printf(“%d“, j);
}
printf(“\n”);
getch();
}
10 -
1234321
12321
121
1
121
12321
1234321
#include <stdio.h>
#include<conio.h>
void main()
{
int i, j, k, l;
clrscr();
for (i=1; i<=4; i++)
{
for (j=1; j<i; j++)
{
printf(“%d”, (“ “);
}
for (j=1; j<=5-i; j++)
{
printf(“%d”, j);
}
J=j-2;
for ( ; j<=1; j++)
{
printf(“%d“, j);
}
printf(“\n”);
}
for (i=1; i<=4; i++)
{
for (k=1; k<=4-i; k++)
{
printf(“%d”, (“ “);
}
for (j=1; j<=i; j++)
{
Printf(“%d“, j);
}
for (i=i-1 ; i>=1; i--)
{
printf(“%d“, i);
}
printf(“\n”);
getch();
}
11 -
*
**
***
****
*****
#include <stdio.h>
#include<conio.h>
Void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=1; j<=i; j++)
{
printf(“*”);
}
}
getch();
}
12 -
*****
****
***
**
*
#include<conio.h>
Void main()
{
int i, j;
clrscr();
for (i=1; i<=5; i++)
{
for (j=1; j<=(6-i); j++)
{
printf(“*”);
}
printf(“\n”);
}
getch();
}
c programmming online,basic of c language,structure of c programming,c language statements,Compiling a C Program,Pseudo Codes in c,basis data type in c ,variables in C Program,constants in C Program,c operators in C Program,special operators in C ,Decision Making,Branching & Looping in C Program,if statement in C Program,for loop in C Program
No comments:
Post a Comment