C Programming Tutorial – 20 – What about more than two choices?

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

47 responses to “C Programming Tutorial – 20 – What about more than two choices?”

  1. yousuf ak Avatar

    I am new to coding. It was going smooth until loops and I observed a strange thing about it when I reached a program which was to print all prime numbers from 1 to n. There are so many variables declared and I basically want to know how, when and most importantly WHY do we declare so many variables. If someone can explain this, it will definitely be a game changer for me. Thanks in advance.

  2. sangmin park Avatar

    Why don't you use an ampersand sign before avg in your printf( "Average: %.2f", avg);

  3. Nidhish Sharma Avatar

    this is offensive to my grades

  4. Nidhish Sharma Avatar

    i am the 111,000 view yayyy

  5. Hassan Khan Avatar

    What is this for?

    printf ("Average %.2f")

  6. Luka Rossi Avatar

    Thanks for these tutorials, Bucky

    I started from null and now I know so much and even to program myself a little
    Thank you! 🙂
    P.S. still learning

  7. Rohan Nimbalkar Avatar

    Sir, please don't record your videos full screen. It becomes easy ton read and understand fast when your videos are cropped and only the coding area is kept.

  8. Yasin Ali Avatar

    we could also use all as if statement. Than why we use else if can anyone tell me?

  9. Yassine Oueslati Avatar

    i Think he's not using he's channel anymore :/ .. u were the Best bucky i even seen.
    (''And the only bucky in this damn planet n");

  10. Rustam Safarli Avatar

    well i'm definitely dumb

  11. THE MICK Avatar

    Hey Bucky I think your videos are great! I have a question about Code Blocks… I used to type in functions like "printf" and before i finished typing code blocks used to auto detect what I wanted and now it's not doing that. Do you know how I could get Code Blocks to detect what function I want again? I don't know what I did in the settings but now I have to type the whole function instead of letting Code Blocks detect it for me.. Thanks!

  12. Alexey Sapov Avatar

    Anyway you are a good teacher 🙂

  13. HABELFOC _ Avatar

    Ini lebih bagus! lol

    int main()
    {
    float penggal1;
    float penggal2;
    float penggal3;

    printf("Markah Penggal 1:n");
    scanf(" %f", &penggal1);

    printf("Markah Penggal 2: n");
    scanf(" %f", &penggal2);

    printf("Markah Penggal 3: n");
    scanf(" %f", &penggal3);

    float purata = (penggal1 + penggal2 + penggal3) / 3;
    printf("PURATA: %f.2 n", purata);

    if (purata >= 85) {
    printf("Grade An");
    } else if (purata >= 75) {
    printf("Grade B n");
    } else if (purata >= 65) {
    printf("Grade C n");
    } else if (purata >= 55) {
    printf("Grade D n");
    } else {
    printf("Don't give up! try next time n");
    }

    return 0;
    }

  14. Ralk Paelmo Avatar

    #include <stdio.h>
    #include <stdlib.h>
    int main ()
    {
    printf("I LAUGHED SO HARD FOR THE ""YOU ARE DUMB"" XD");

    return 0;
    }

  15. Marco Pavicic Avatar

    The people with less than 60% are the ones watching ur vids dawg. We aint dumb, just slow. Thanks for the help btw! Comp mid-term tomorrow!

  16. harmonic spice Avatar

    thanks man i am getting better and better you are good but you pass some stuff but i got anyway

  17. Gravice Avatar

    I love your tutorals dude thanks a lot !!

  18. yerrapotu kiran Avatar

    If grades decide intelligence then einstine would be called as dumb for all of his life

  19. Tannya Seth Avatar

    sir , i am typing 4 time the grade then i am getting average as 90, like 90 90 90 90 avg= 90; for same pgm?
    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
    float grade1;
    float grade2;
    float grade3;
    printf("enter your grade n");
    scanf(" %f ", &grade1);
    scanf(" %f ", &grade2);
    scanf(" %f ",&grade3);

    float average= (grade1 + grade2 + grade3)/ 3;
    printf("avg is %.2f", average);

    if (average>= 80)
    {
    printf(" n excellent");
    }
    else if( average>=70){
    printf(" n good");
    }

    else if (average>=60){
    printf(" n ok");

    }
    else {
    printf(" n dumb");

    }

    return(0);
    }

  20. IndiCoder Avatar

    Doesn't any grade >90 also means >60 too ? Then why doesn't the code gets confused? Is it better to mention something like 60<average<=70 ?

  21. burton 2202 Avatar

    where are the actual codes at? I didnt find on the website

  22. Mii Likes Yoshi Avatar

    Is the if statement the same in every language? I learned it in PHP, JavaScript, Java, C++, and Python and they are all very similar.

  23. Mauricio Dávalos Avatar

    why is he using SPACE before %f ? I thought you should only use that when sacanning characters with %c

  24. shizyninjarocks Avatar

    "You are dumb" hahahahaha

  25. Keenal Shah Avatar

    You are funny and that is the only reason I picked to watch your tutorials over others lol

  26. Resid Talibov Avatar

    int age;
    char ad;
    printf("adin nedir?");
    scanf("%s",ad);

    printf("Nece yasin var?n");
    scanf("%d",&age);

    if(age<15){
    printf(" %s Uzgunem amma bu application senin ucun deil!",ad);
    }
    else{
    printf(" %s Bu vebsayta qebul edildin",ad);
    }
    Have i got mistake i compile it and it says 0 error but when it opens after the 1st scanf it closes why?
    +thenewboston

  27. Asfand Shakeel Avatar

    where can i get this tutorial's code?

  28. Dibyendu Db Avatar

    awesome. But why are you always humorous

  29. Ocheencheen daisuki Avatar

    Hurting my feelings Bucky, I am a dumb kid

  30. Tina Soerensen Avatar

    So your website is not buckysroom anymore. So at thenewboston website. Where can I find the codes you are using in your tutorials here?

  31. allen castano Avatar

    how am i going to learn if i cannot see the codes. because its too far
    tutorial vids from 1 upto 15? is much better because its easy to see..

  32. Ivan Antunović Avatar

    int main()
    {
    int age1;

    printf("Enter the age of your first kid. n");
    scanf(" %d", &age1);

    if(age1 >= 16)
    {
    printf("Your first child can drive a car in USA. n");
    }else if(age1 >= 18){
    printf("Your first child can drive a car in EU and USA. n");
    }else{
    printf("Your first child cannot drive a car in USA nor in EU.");
    }

    return 0;
    }

    how can I make this code to write "Your first child can drive a car in USA." only for ages in range of 16 – 17 because whenever I write that age1>16 it never prints "Your first child can drive a car in EU and USA."

  33. Ilm Seeker Avatar

    Pro tip:

    instead of:

    printf("Enter the first three grades:n");
    scanf(" %f n %f n %f", &grade1);
    scanf(" %f n %f n %f", &grade2);
    scanf(" %f n %f n %f", &grade3);

    It can be shorten:

    printf("Enter the first three grades:n");
    scanf(" %f n %f n %f", &grade1, &grade2, &grade3);

  34. Stella Nina Avatar

    cool, it helped a lot and didnt fall sleep 😀 thanks a lot!! )))

  35. zmunk Avatar

    can i use (if..else if…else if) statements? Without using an else at the end?

  36. roger alvarez Avatar

    can you give the link for your website to find the code used in the video. please and thank you

  37. Vineet Ludhani Avatar

    I am getting an error while compiling.. The error is expected expression before '%' token… How do I get past by this error?

  38. Daski69 Avatar

    Is there any other point to 'else if' than faster programs? you could just use a bunch of if-statements right after each other although in that case the program would have to check all of them

  39. Leverquin Avatar

    one-size-fits-all

  40. sluttyfuck19 Avatar

    We could have used only if SCCHHHtatements if we gave more accurate information about the grades? I see this is more easy but jus wondering if we could do it without else if

  41. slazy Avatar

    great help man , big help

  42. Spectrum Avatar

    For anyone looking to take this exercise to a higher level, here is my source code:

    #include <stdio.h>
    #include <stdlib.h>

    int main(){

        float grade1;
        float grade2;
        float grade3;
        float average;

        printf("Enter your three test gradesn");

        scanf(" %f", &grade1);
        scanf(" %f", &grade2);
        scanf(" %f", &grade3);

        average = (grade1 + grade2 + grade3) / 3;

        printf("Average: %.2f n", average);

        if(average >= 90){

            printf("You earned an A!");

        }else if(average >= 80 && average <= 89){

            printf("You earned a B");

        }else if(average >= 70 && average <= 79){

            printf("You earned a C");

        }else if(average >= 60 && average <= 69){

            printf("You earned a D");

        }else{

            printf("You earned a F");

        }
        return 0;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *