I meant for it to add an input value to a variable initialized to 0, multiple times. Should I change the condition so that x>=0?
Type: Posts; User: rocksteady
I meant for it to add an input value to a variable initialized to 0, multiple times. Should I change the condition so that x>=0?
Here is my revised code:
int sum (int x, int y)
{
int sum; /* sum of the two input numbers */
for (sum=0; x<y; sum+y)
x--;
Edited: hindsight is 20/20 :(
Hello everyone,
I'm trying to write pseudocode for a function that uses repeated addition instead of multiplication. In other words, inputting 2 and 5 should return 10, using only addition.
So...
Problem Statement
I'm working with a problem that asks to test the feasibility an optimal order algorithm. The problem says something along the lines of: we want to visit each of 25 cities once and...
Thank you. I was confused on how to insert the call functions, but that's because I didn't really know what a header file was.
I have a program that I want to split into two separate source code files, plus a single header file. The first source file should just have the main function that takes care of the input and calls...
Hi,
I'm writing some code using the getchar function. The program should get the input character by character (using getchar) and ending when a new line character 'n' is reached or the EOF...