Here's my Prog...i dunno how 2 convert it...pls check..
its a pyramid...

#

#include<stdio.h>
main()
{ int a, b, c, d=0;
   clrscr();
   printf("Enter a No:");
   scanf("%d",&c);
   for(a=1;a<=c;a++)
   { for(b=1;b<=c*2-1;b++)
    if (b<=c+d&&b>=c-d)
    printf("*");
    else 
    printf(" ");
    printf("\n");
    d++;
   }
   getch();
  }

is my program correct?
the output must be..a pyramid

Here's my Prog...i dunno how 2 convert it...pls check..
its a pyramid...

#

#include<stdio.h>
main()
{ int a, b, c, d=0;
   clrscr();
   printf("Enter a No:");
   scanf("%d",&c);
   for(a=1;a<=c;a++)
   { for(b=1;b<=c*2-1;b++)
    if (b<=c+d&&b>=c-d)
    printf("*");
    else 
    printf(" ");
    printf("\n");
    d++;
   }
   getch();
  }

is my program correct?
the output must be..a pyramid

Use int main. Its seams ok to me but I dont like non standard functions like clrscr() and getch.

well, if you run it, it shows: a Pyramid :eek:

so I guess it works

But use int main()
Do't use clrscr() and getch()

edit:

Brilliant minds think alike :P

can anyone help me to make a program that would output a pascal triangle...???????
thanx..

Here's my Prog...i dunno how 2 convert it...pls check..
its a pyramid...

#

#include<stdio.h>
main()
{ int a, b, c, d=0;
   clrscr();
   printf("Enter a No:");
   scanf("%d",&c);
   for(a=1;a<=c;a++)
   { for(b=1;b<=c*2-1;b++)
    if (b<=c+d&&b>=c-d)
    printf("*");
    else 
    printf(" ");
    printf("\n");
    d++;
   }
   getch();
  }

is my program correct?
the output must be..a pyramid

Hmmm....yeah, im only asking bcoz my TC is not workign at our house...still thanks for ur advice, i also tried the program..and it work..i only nid the pascal triangle...i've made a program but seems there is a declaration syntax, i can't figure it out what's wrong pls help..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.