* ** *** **** *****
#include <stdio.h>
int main()
{
int i, j, k;
for(i=5;i>=1;i--)
{
for(j=1;j<i;j++)
{
printf(" ");
}
for(k=5;k>=i;k--)
{
printf("*");
}
printf("\n");
}
return 0;
}
Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C
Than a lot ........this helped me alot........
ReplyDeletestar pattern 3 coding is rong
ReplyDelete#include
ReplyDeletemain()
{
int n;
printf("enter no of rows:");
scanf("%d",&n);
int temp=n;
for(int r=1;r<=n;r++)
{
for(int c=1;c<temp;c++)
printf(" ");
temp--;
for(c=1;c<=r;c++)
printf("*");
}
}
its wrong
Deletecheck the code
pattern 3:
ReplyDelete#include
#include
void main() {
int i,j,k;
clrscr();
for (i=1; i<=5; i++) {
for (j=5; j>=i; j--) {
printf(" ");
}
for (k=1; k<=i; k++) {
printf("*");
}
printf("\n");
}
getch();
}
this is not working properly
ReplyDeletePattern 3:just 2 for loops
ReplyDeleteint main() {
int n,i,j;
scanf("%d",&n);
for(i=0;i=n-1)
{
printf("#");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}
#include
ReplyDelete#include
void main()
{
int i,j ,k ,n;
printf("Enter no. of rows");
scanf("%d",&n);
for(i=n; i>=1; i--)
{
for(j=1; j<=1;j++)
{
printf(" ");
}
for(k=1; k<=n; k++)
{
printf("*");
}
printf("\n");
}
return 0;
}
Can someone please explain the logic?
ReplyDeleteint main()
ReplyDelete{
int i, j, k;
for(i=1;i<=5;i++)
{
for(j=5;j>i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("*");
}
printf("\n");
}
}
int main()
ReplyDelete{
int i,j,n=9;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(j>=(n-i+1))
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
}
Rubbish code
DeleteNice and helpful....
ReplyDeletelearn more pattern examples...
C pattern programming examples
Diamon Star Pattern in C