Aha! I'm only posting because I'm quite happy that I just wrote my own program! Not required by the book. I decided I'd write a program to figure out the remainder. % of two numbers entered by a user (me). I'm pleased because I wrote it in only about 15 minutes! I feel like I'm getting better at understanding this stuff, and I know in some cases how to use the code I've learned so far to get it to do what I want it to do.
My primary problem is still understanding what the book wants me to do in certain (many, as you know) problems. I think when the problem is mine, I'm already a few steps ahead in the process of how to think about it and break it down (smaller parts) into what I want and in writing pseudo code. I guess I've got some trouble comprehending and understanding what the book wants sometimes.
Anyway, here it is for all to see! A small victory for me in my quest for C! Hey that rhymed!🙂
My primary problem is still understanding what the book wants me to do in certain (many, as you know) problems. I think when the problem is mine, I'm already a few steps ahead in the process of how to think about it and break it down (smaller parts) into what I want and in writing pseudo code. I guess I've got some trouble comprehending and understanding what the book wants sometimes.
Anyway, here it is for all to see! A small victory for me in my quest for C! Hey that rhymed!🙂
Code:
#include <stdio.h>
main ()
{
int remainder, numerator, denominator ;
printf ("This program computes the remainder of user entered numbers," ) ;
printf ("0 to exit\n") ;
do {
printf ("Enter a number: ") ;
scanf ("%d", &numerator) ;
if (numerator == 0) goto done;
printf ("Enter a number: ") ;
scanf ("%d", &denominator) ;
remainder = numerator % denominator ;
printf ("%d\n", remainder) ;
} while (numerator != 0);
done: printf ("Thank you, have a nice day\n") ;
return 0;
}