User Profile

Collapse

Profile Sidebar

Collapse
Crcullen3916
Crcullen3916
Last Activity: Mar 1 '07, 10:48 PM
Joined: Mar 1 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Crcullen3916
    replied to Odd numbers using a for loop help
    in C
    This is my output:

    Code:
    Cassandra Cullen                Assignment 3
    
    Enter a value, 0 to stop > 1
    
    the sum of the first 1 cubes is 1
    the check is 1  CORRECT
    
    the sum of the first 1 odd numbers is 0
    the check is incorrect
    
    Enter a value, 0 to stop > 2
    the sum of the first 2 cubes is 9
    the check is 9  CORRECT
    
    the sum of the first 2 odd
    ...
    See more | Go to post

    Leave a comment:


  • Crcullen3916
    started a topic Odd numbers using a for loop help
    in C

    Odd numbers using a for loop help

    Hi, I have this assignment that I have almost finished except I have one problem. I'm having trouble making my for loop find the sum of the first n odd numbers ( n being the variable in which a value is read in)
    oddnum and oddsum are the variables i came up with
    This is what I have so far :

    Code:
    int sumodd (int n)
    {
        int oddnum, oddsum = 0;
       
        for (oddnum = 1; oddnum <= n; oddnum++)
    ...
    See more | Go to post
No activity results to display
Show More
Working...