- This topic is empty.
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Software programming learning aide
CS50 threads to aide as a supplementary resource › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 1 › Approaching cash project without functions
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int t = get_int("enter cents");
int count25 = t / 25;
int count10;
t = t % 25;
printf("count25 is %i\n", count25);
printf("remaining t after count25 %i", t);
if (t > 9)
{
count10 = t / 10;
}
else
{
count10 = 0;
}
printf("count10 is%i\n", count10);
int totalcoins = count25 + count10;
printf("total coin count%i\n", totalcoins);
}
Cash project prepares one to start using functions in programming. However, the same can be also done without creating functions through the main function.
[learn_press_profile]