C Language Programme
programmer:- Mr. Shashi kant srivastava (sks sir)
Example 1: Program to print half pyramid using *
* * * * * * * * * * * * * * *
Source Code
#include <stdio.h>
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}
Example 2: Program to print half pyramid a using numbers
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
Source Code
#include <stdio.h>
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1; i<=rows; ++i)
{
for(j=1; j<=i; ++j)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
Example 3: Program to print half pyramid using alphabets
A B B C C C D D D D E E E E E
Source Code
#include <stdio.h>
int main()
{
int i, j;
char input, alphabet = 'A';
printf("Enter the uppercase character you want to print in last row: ");
scanf("%c",&input);
for(i=1; i <= (input-'A'+1); ++i)
{
for(j=1;j<=i;++j)
{
printf("%c", alphabet);
}
++alphabet;
printf("\n");
}
return 0;
}
Example 4: Inverted half pyramid using *
* * * * * * * * * * * * * * *
Source Code
#include <stdio.h>
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=rows; i>=1; --i)
{
for(j=1; j<=i; ++j)
{
printf("* ");
}
printf("\n");
}
return 0;
}
Example 5: Inverted half pyramid using numbers
1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Source Code
#include <stdio.h>
int main()
{
int i, j, rows;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=rows; i>=1; --i)
{
for(j=1; j<=i; ++j)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
revo uninstaller pro crack
ReplyDeleteThis article is so innovative and well constructed I got lot of information from this post. Keep writing related to the topics on your site. the link
ReplyDeleteavast driver updater crack
ReplyDeleteAtomic Email Hunter Crack
ReplyDeleteFl Studio Crack
Cracks
Ntlite Crack
Powerarchiver Crack
Mackeeper Crack
Mirillis Action Crack
ReplyDeletebytefence licence key hack accompanies a smooth, easy to understand interface that packs a small bunch of direct capacities, permitting numerous clients to require their abilities with insignificant exertion. In spite of the fact that it doesn't incorporate any type of standard help documentation, its controls are excessively natural such that they can work without extra help.
ReplyDeleteIt’s perfect time to make some plans for the long run and it is time to
ReplyDeletebe happy. I have read this publish and if I may I wish to counsel you some interesting issues or tips.
Maybe you could write next articles relating to this article.
I wish to read even more issues approximately it!
adguard free license key
bluebeam product key
airparrot keygen
wps office activation code free
lansweeper crack
Crack Like
I am very thankful for the effort put on by you, to help us, Thank you so much for the post it is very helpful, keep posting such type of Article.
ReplyDeleteEasy Translator Crack
AirMyPC Crack