16) Sample C Program to print numeric pyramid.
# include <stdio.h>
# include <conio.h>
main()
{
int i, j;
clrscr( );
for(i = 1; i <= 5; i++)
{
for(j = 1; j <= i; j++)
printf("%d", j);
printf("\n");
}
getch();
}
17) Sample C Program to print numerical pyramid.
# include <stdio.h>
# include <conio.h>
main()
{
int i, j, l, k = 40;
clrscr( );
for(i = 1; i <= 9; i += 2)
{
for(l = 1; l <= k; l++)
printf(" " );
for(j = 1; j <= i ; j++);
printf("%d", j);
printf("\n");
k = k - 2;
}
getch( );
}
18) Sample C Program to print numerical diamond.
# include <stdio.h>
# include <conio.h>
main( )
{
int i, j, l, n, s, k = 40;
clrscr( );
for(i = 1; i <= 9; i += 2)
{
for(l = 1; l <= k; l++)
printf(" ");
for(j = 1; j <= i; j++)
printf("\n");
k = k - 2;
}
k = k + 4;
for(n = 7; n >= 1; n -= 2)
{
for(i = 1; i <= k; i++)
printf(" ");
for(s = 1; s < n; s++)
printf("%d", s);
printf("\n");
k = k + 2;
}
getch( );
}
ALSO CHECK THESE C PROGRAMS:
- C Program to print character pyramid.
- C Program to print character diamond.
- C Program To Display A Sequence Using Stars.
- C Program To Print A Star Pyramid.
- C Program To Print Floyd’s Triangle.
- C Program to find biggest of two no by using ternary operator.
- C Program to find biggest of four nos. by using Ternary Operator.
- C Program to find smallest of four nos. by using Ternary Operator.
- C Program to accept a year and check the whether the given year is a leap year or not by using ternary operator.
- C Program to accept a character in Uppercase & print in Lowercase.
- C Program to find biggest of four nos. by using Ternary Operator.
- C Program to find smallest of four nos. by using Ternary Operator.
- C Program to accept a year and check the whether the given year is a leap year or not by using ternary operator.
- C Program to accept a character in Uppercase & print in Lowercase.
...Back To C Program Index.
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com