GithubHelp home page GithubHelp logo

mareksuscak / cs50 Goto Github PK

View Code? Open in Web Editor NEW
416.0 48.0 408.0 21.96 MB

๐ŸŽ“ Harvard CS50x โ€” 2018 solutions ๐Ÿ‘จโ€๐Ÿซ

Home Page: https://cs50.harvard.edu/x/2020/

Makefile 2.01% C 50.48% Python 25.17% CSS 2.77% HTML 15.03% JavaScript 4.54%
c python cs50 cs50x algorithms data-structures

cs50's Issues

R

Ja

Finance Issue

When i submit the finance task, i take an error says: /check route confirms whether username is available. Can you guys help me please?

Im newbie learning a lot, can u explain

Hi Marek,

Im very new to this, can u explain from line 30 to 36. From my understanding, (cc_number % 10 = digit1) is to obtain the last number(if im not mistaken)? But why is digit2 = digit1? and why sum_of_even +=digit1? I look forward for your reply and would greatly appreciate a detailed explanation. Thanks!

My quesiton about line 47 in pset1-credit.c

Hey Marek,

Thanks for your sharing,
I am wandering in pset1 credit line 47, why the code is:
int multiple = 2 * digit1;
sum_of_double_odds += (multiple / 10) + (multiple % 10);
instead of:
(sum_of_double_odds += digit1 * 2) ?
Please correct me if I am wrong, say if the digit is 7, with your code the sum_of_double_odds
would add on 14 / 10 = 1.4 = 1, plus 14 % 10 = 4, which the result would be 5 instead of 14.

PSET 01_Cash project

I finished my codes for the "Cash" in the problem set 1. It ran well except when I tried 0.42 or other values less than 0.2.

I would be very appreciated if anyone can help me with this problem? The code is provided below.

Thank you a lot.

`#include <cs50.h>
#include <stdio.h>
#include <math.h>

int main(void)
{
int amount;
int pennies;
int dime;
int nickle;
int quarter;

do
{
    float received_money = get_float("Money received: ");
    amount = received_money * 100;
}    
    while (amount <= 0);
    do    
    {
        quarter = amount/25;           
    }
    while (quarter > 25);
                
        do
        {
            dime = (amount%25)/10;                
        }
        while (dime > 10);
            
            do
            {
                nickle =  ((amount%25)%10)/5;                    
            }
            while (nickle > 5);
    
                do
                {
                    pennies = (((amount%25)%10)%5);                        
                }
                while (pennies > 1);                                        
printf ("Cashout: %i\n", pennies + dime + nickle + quarter);

}
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.