- 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.
Computer science, programming - relevant posts, community threads, and courses
IT, Programming, & Web Development › Forums › CS50’s Introduction to Computer Science by Harvard University on Edx › Week 1: [C] – Data Types, Operators, Conditional Statements, Loops, and Command Line › Approaching cash project without functions
[dm_code_snippet background=”yes” background-mobile=”no” slim=”yes” line-numbers=”yes” bg-color=”#abb8c3″ theme=”dark” language=”clike” wrapped=”no” height=”” copy-text=”Copy Code” copy-confirmed=”Copied”]
#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); }
[/dm_code_snippet]
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]