Hi to all
I need help with this program, i have problem, i must write it out from left to right not from right to left, but i do not know how to do it, when i change something in program, than it is not working :(


here is the program, i am writing it in visual studio 2005

#include<stdio.h>

void pasc(int n)
{
      int r;
 long fact(int);
            for(r=0;r<=n;r++)
                  printf("%3ld",fact(n)/(fact(n-r)*fact(r)));
}
 
long fact(int v)
{
  if(v==1||v==0)
        return(1);
  else
        return(v*fact(v-1));
}
int main()
{

int l,i,n,j;
void pasc(int);

printf("\n\nUnesite broj redaka: ");
scanf("%d",&l);

printf("\n");
printf("\nPascalov trokut :\n");

for(j=l-1;j>=0;j--)
             printf("   ");
printf("  1\n");

for(n=2;n<=l;n++)
{
      for(i=l-n;i>=1;i--)
           printf("   ");
 pasc(n);
 printf("\n");
}


}

Recommended Answers

All 3 Replies

This specific problem has been addressed before. In the future, please search the forum before you post, chances are that someone else had that assignment/problem. Please take a look at the following thread for some guidance:
http://www.daniweb.com/forums/thread49939.html
Hope that help and welcome aboard. By the way, as a new person, you did good in the proper way of posting in terms of formating with code tags. Except, in the furure:
before adding your code, use ["code=cplusplus"]
code here
and use ["/code"] when your done. This way it number your code, so when you start doing longer/harder assignments we can follow your code line by line.

sori i forget to search the forum, it will not happen again ;)


thanks for solution it help

In the method of formatting that i had suggested...do it exactly, just leave out the " . Also, if you've got your desired answer, and your satisfied, please mark this thread as being SOLVED(option at the bottom of this page). This prevents from making people continually looking at and trying to solve the post again. Hope you'll enjoy the Forum.

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.