User Profile

Collapse

Profile Sidebar

Collapse
AmLegacy
AmLegacy
Last Activity: Feb 25 '08, 03:34 AM
Joined: Feb 9 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • AmLegacy
    started a topic Pascal_Triangle
    in C

    Pascal_Triangle

    Hi,

    Right now my program runs a beautiful pascal triangle up to 5. The only problem is that I want the user's input n to be the last row the triangle prints. When I replace n for in 5 in the first for loop it doesn't print the triangle. I know it's something simple. I've been focused so many hours trying to get this to work I've forgotten the basics..maybe.

    [CODE=cpp]int factorial (int n)

    {
    if...
    See more | Go to post
    Last edited by Ganon11; Feb 25 '08, 12:22 AM. Reason: Please use the [CODE] tags provided.

  • AmLegacy
    replied to Gcd
    in C
    int my_gcd (int *m, int *n)

    {
    while (m > 0)
    {
    if (n > m)
    { int t = m; m = n; n = t; }

    m -= n;

    }

    }
    See more | Go to post

    Leave a comment:


  • AmLegacy
    started a topic Gcd
    in C

    Gcd

    Can anyone help me with coding the GCD? I want to take two integers 56 and 42 and divide them x amount of times until the remainder is 0. Once the remainder is 0 that divisor becomes my GCD.
    See more | Go to post

  • AmLegacy
    started a topic simplify fractions
    in C

    simplify fractions

    I'm having a hard time figuring out how to simplify the fractions. Can anyone look at this code and see if you can see something I don't.

    [CODE=c]//This is the fraction adding function
    void add_fractions (int a, int b, int c, int d, int *ansn, int *ansd)
    {
    //int e, x, y, rem, gcd;
    a = a*d; //numerator 1 * denominator 2
    c = c*b; //numerator 2 * denominator 1
    b = b*d; // denominator 1 * denominator...
    See more | Go to post
    Last edited by Ganon11; Feb 19 '08, 03:14 AM. Reason: Please use the [CODE] tags provided.

  • AmLegacy
    replied to Nested Loops
    in C
    Would you add two new variables and nest a decremented double for loop? With k being greater than or equal to n?
    See more | Go to post

    Leave a comment:


  • AmLegacy
    started a topic Nested Loops
    in C

    Nested Loops

    Hi, I'm trying to draw:
    0
    01
    012
    0123
    01234
    0123
    012
    01
    0
    So far I have the beginning for (i=1; i<=n; ++i)
    { for (j=0; j<i; ++j)
    {printf("%d ", j);}
    printf("\n" );
    ...
    See more | Go to post
No activity results to display
Show More
Working...