We were informed to "write a program in C that reads two whole numbers into two variables of type int, and then outputs both the whole number part and the remainder of the division of the first number by the second. This can be done by using the operators = and %."

I've completed the code, but since I'm new at this, is there a better way of writing this in C?

/*A program to read and perform operations on integers */ #include <stdio.h> /* declaring the operations will be on integers*/ int divide(int,int); int remain(int,int); int main() { int whole_1, whole_2, answer, rem; printf("Input your first value:"); /* tells user to enter first number*/ scanf("%d", &whole_1); printf("now input the next value:"); /* tells user to enter second number*/ scanf("%d", &whole_2); answer = divide(whole_1, whole_2); /* divides the first by second value*/ printf("Dividing %d by %d is %d \n", whole_1, whole_2, answer); rem = remain(whole_1, whole_2); /* also calculates a remainder*/ printf("Also, the remainder is %d \n", rem); return 0; } /* below informs what maths to do on the values*/ int divide(int a, int B)/>/> { return a / b; } int remain(int a, int B)/>/> { return a % b; }

Secondly, we needed to use C to print:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

I realize the policy about not doing the homework assignments, but I was hoping for a step in the right direction. Could I theoretically use

#include <stdio.h> int main() { char i = '+' ; printf("%c%c%c%c%c",i,i,i,i,i); return 0; }

And repeat per line? Searched a lot on the topic but none seem to discuss line space omission and such.

Thanks again in advance!