#9: If Else Statements in C | C Programming for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

ความคิดเห็น • 417

  • @programizstudios
    @programizstudios  2 ปีที่แล้ว +18

    🚀 Loved the tutorial? Take it further with Programiz PRO!
    Refine your skills, conquer coding fears, and build confidence with interactive lessons, quizzes, and challenges. Strengthen your programming foundation and master C today!
    👉Start Here: bit.ly/c-master

  • @yunandaraung2556
    @yunandaraung2556 2 ปีที่แล้ว +71

    You explain a lot better than my professor from college. Thanks for making things easier!

    • @marwaneharris4460
      @marwaneharris4460 ปีที่แล้ว +3

      how you did after 11 months?

    • @zackmansouri986
      @zackmansouri986 16 วันที่ผ่านมา

      it's my first year in the uni and I didn't understand from my professor now I'm able to write simple codes easily and I'm still advancing

  • @srpcdgaming
    @srpcdgaming ปีที่แล้ว +15

    The answer is A: inside if
    Also love your tutorials they're amazing. Keep it up👍

    • @purpleocean5670
      @purpleocean5670 ปีที่แล้ว +1

      no the answer will be inside else because a%2=1

    • @MeowwJane
      @MeowwJane 8 หลายเดือนก่อน +6

      @@purpleocean5670but it has the not symbol (!) so it's reversed

  • @fountain9886
    @fountain9886 ปีที่แล้ว +37

    i do not know why university Professors are making these easy lessons so much difficult and unbearing, Thank you @programiz

  • @krishsharma162
    @krishsharma162 3 ปีที่แล้ว +23

    Ma'am, these lectures are very helpful.

  • @miarose5382
    @miarose5382 3 ปีที่แล้ว +113

    Answer is A : Inside if

  • @nickjonaz3710
    @nickjonaz3710 ปีที่แล้ว +3

    God bless u ma’am. I love how she explains things very fluently ✍🏾

  • @erl2nd
    @erl2nd 2 ปีที่แล้ว +33

    Your work is immaculate efficient and you are truly an inspiration.
    I was not doing well at all at University of but now you have given
    Me new hope.
    Thank you!!!

    • @user-tz1wb2gt7n
      @user-tz1wb2gt7n ปีที่แล้ว +1

      Mind If I ask how you did ?

    • @erl2nd
      @erl2nd ปีที่แล้ว

      @@user-tz1wb2gt7n actually wound up in Fall: 1B in the "C" programing and 1C for Calculus dropped psychology, But in Spring '23 all A's for 4classes 12 semester hours the 2nd Semester, I left that University to become a pilot all A's Fall Semester start ground and flight ✈️ labs Jan '24, Thanks for asking! Hope you are well and thank you for being there.

  • @alirezaz9896
    @alirezaz9896 2 ปีที่แล้ว +4

    one of the best c tutorials i have ever seen!!😊😊

  • @Tatchim
    @Tatchim ปีที่แล้ว +70

    #include
    #include
    //déclaration of variable
    int main() {
    double number;
    printf("enter a double number");
    scanf("%lf",&number);
    if(number>0){
    printf("number is positive");}
    else if(number

    • @Pop_shorts_369
      @Pop_shorts_369 11 หลายเดือนก่อน +1

      Good job

    • @danieldaniekl6222
      @danieldaniekl6222 4 หลายเดือนก่อน +1

      else if(number

    • @najiibjama9906
      @najiibjama9906 3 หลายเดือนก่อน

      @@danieldaniekl6222 Have you understood the question?
      The guy followed the instructions of the question but you ...

  • @With.h
    @With.h ปีที่แล้ว +4

    Thank youuu it was helpfull
    int main() {
    double number;
    printf("Enter The Number:");
    scanf("%lf",&number);
    if (number>0){
    printf("The Number is Positive!");
    }
    else if(number

  • @aysham.8398
    @aysham.8398 2 ปีที่แล้ว +2

    I tried to watch different video on the topic but this one is different and concise.
    Thank you ms!

  • @MadCrusherYT_006
    @MadCrusherYT_006 3 หลายเดือนก่อน +1

    it made my course very easy to compete and in very short time mam
    Thank you for giving your knowledge for students like us mam

  • @henryalbrightekenimdeokpos905
    @henryalbrightekenimdeokpos905 8 หลายเดือนก่อน +1

    Wow, This video Really Helped me in understanding the if/else statements in C. Thank You @programiz for these lessons, God Bless You

  • @akibiswhere
    @akibiswhere ปีที่แล้ว +2

    A real beginner -
    #include
    int main(){
    double number;
    printf("Enter any number
    ");
    scanf("%lf", &number);
    if(number>=1){
    printf("The number is positive");
    }else if(number

  • @neetdiagramacticlearning4173
    @neetdiagramacticlearning4173 2 ปีที่แล้ว +1

    my life saviour...u made me develop interest in c by taking away my aversion..thanks mam

  • @TewodrosBaye1
    @TewodrosBaye1 ปีที่แล้ว +3

    The cutest programming teacher ever. Thanks for making it easier to understand.

  • @MarkjonelDumlao
    @MarkjonelDumlao 3 หลายเดือนก่อน +1

    Better explanation than my professor teacher😊

  • @boramawi
    @boramawi 2 ปีที่แล้ว +2

    Wonderful Explanation with very short examples which are easy to follow.

  • @julia512
    @julia512 2 หลายเดือนก่อน +3

    I'm a 1st year college student in computer science engineering, I'm leaving this commrnt to keep track of my developpement and to stay motivated.
    8/11, I'm able to make a c language program with if statement

  • @AlaskarAbdoul
    @AlaskarAbdoul ปีที่แล้ว +18

    /*
    Can you create a program to check whether a number is positive
    or negative or 0?
    To create this program, create a variable
    named number and assign a double value to it based on the user
    input. Then using an if statement,
    check if the number variable is positive or negative or 0.
    > If number is positive, print"The number is positive"
    > If number is negative, print"The number is negative"
    > If number is 0, print "The number is Zero"
    */
    #include
    int main() {
    double number;
    printf("Please write your number and I will let you know if its
    positive number,
    zero, or
    negative number:
    ");
    scanf("%lf", &number);
    if (number < 0){
    printf("The number is negative.");
    }
    else if (number == 0){
    printf("The number is Zero.");
    }
    else if (number > 0){
    printf("the number is positive.");
    }
    return 0;
    }

  • @emmydee408
    @emmydee408 2 ปีที่แล้ว +2

    Thank you so much for this video ma.... The answer is A (inside if)

  • @flick-ict2276
    @flick-ict2276 2 ปีที่แล้ว +4

    I love this video ❤️, I understood it perfectly well

  • @raghumanda2tanush496
    @raghumanda2tanush496 2 ปีที่แล้ว +3

    really helpful course , simple and effective explanation

  • @AmanGupta-zp5xi
    @AmanGupta-zp5xi ปีที่แล้ว +2

    Thank you mam, you have explained wonderfully 😊

  • @easyorganic1469
    @easyorganic1469 ปีที่แล้ว +4

    Mam these videos are very useful. Thank you for helping us. If possible please make a series on c++ language and dsa in it. this will be very benificial for me and many more like me. Thank you.]

  • @tambirogerenow5863
    @tambirogerenow5863 10 หลายเดือนก่อน

    Yeah yeah! 😊 its amazing lecture, the lecture was supper explicit
    Thanks, l like your working background, it's clear, l wish it can be clearer

  • @youngsunday8192
    @youngsunday8192 ปีที่แล้ว

    If Else Statements in c simplified thanks for making it easier
    🙂🙂🙂🙂🙂🙂🙂🙂🙂

  • @mondmare9712
    @mondmare9712 10 หลายเดือนก่อน

    Maam you are very resourceful and helpful. Im following in Papua New Guinea

  • @flashman6620
    @flashman6620 3 ปีที่แล้ว +2

    It,s amazing
    thank you for your efforts

  • @Darkness-898
    @Darkness-898 8 หลายเดือนก่อน +2

    PROGRAMIZ QUIZ ANSWER: OPTION(A) Inside if
    PROGRAMMING TASK GIVEN BY MAM:
    #include
    int main() {
    double num1;
    printf("Enter a number here: ");
    scanf("%lf", &num1);
    if (num1>0){
    printf("The number is positive.");
    }
    else if (num1==0){
    printf("The number is neutral(It is 0).");
    }
    else {
    printf("The number is negative.");
    }
    return 0;
    }

  • @islemkhelifa-ve7ip
    @islemkhelifa-ve7ip ปีที่แล้ว

    inside if , thank you teacher, you are the best

  • @sychok958
    @sychok958 3 ปีที่แล้ว +1

    Video is helpful and understadable~~thanksss a lot

  • @paulmuchemwa7950
    @paulmuchemwa7950 2 ปีที่แล้ว +1

    been learning a lot. also the phone application has good notes to refer to

  • @ritiksingh1484
    @ritiksingh1484 2 ปีที่แล้ว +1

    Love Your Voice ☺

  • @uppilipavitra9634
    @uppilipavitra9634 7 หลายเดือนก่อน

    #include
    int main()
    {
    int a=-5;
    if (a0){
    printf("The number is positive");
    }
    else {
    printf("The number is 0");
    }
    return 0;
    }
    Mam,Your classes are very helpful us thank you so much mam

  • @doctor2345
    @doctor2345 ปีที่แล้ว

    extremely helpful. keep it up!

  • @LearnEnglishThrough_Podcast
    @LearnEnglishThrough_Podcast 2 ปีที่แล้ว +1

    Amazing explanation

  • @tanmaykumartewary2166
    @tanmaykumartewary2166 3 ปีที่แล้ว +2

    This course is really very helpful...plz increase the video frequency.

    • @programizstudios
      @programizstudios  3 ปีที่แล้ว +1

      Thank you! We appreciate your thoughts.

  • @okolieolisafrancis3292
    @okolieolisafrancis3292 3 หลายเดือนก่อน

    Am inspired and it is wonderful

  • @Kevin-w9w
    @Kevin-w9w 4 หลายเดือนก่อน

    So easy to understand thanks

  • @raghavendrarao6973
    @raghavendrarao6973 3 ปีที่แล้ว +2

    thanks a lot maam , your videos are very helpful

  • @h.d4632
    @h.d4632 6 หลายเดือนก่อน +1

    #include
    int main() {
    double number;
    printf ("Enter a number:");
    scanf ("%lf", &number);
    if (number>0){
    printf ("The number %0.2lf is positive",number);
    }
    else if (number

  • @nihatdonmzov4166
    @nihatdonmzov4166 2 ปีที่แล้ว +2

    Thank you so much🙂

  • @plasmageorge4944
    @plasmageorge4944 ปีที่แล้ว +1

    Thank you

  • @like_a_boss881
    @like_a_boss881 ปีที่แล้ว +3

    answer is A (inside if).....I love your channel by the way....keep it up.!

  • @Usmankhan-q8z5s
    @Usmankhan-q8z5s ปีที่แล้ว

    I really inspired to your lecture ❤

  • @bilolnorqobilov5396
    @bilolnorqobilov5396 2 ปีที่แล้ว +22

    int main() {
    double number;
    printf("Enter the number: ", number);
    scanf("%lf", &number);
    if(number>0){
    printf("positive number");
    }
    else if(number

  • @programizstudios
    @programizstudios  3 ปีที่แล้ว +7

    Q. What is the output of the following code?
    #include
    int main() {

    int a = 5;
    if (!(a % 2 == 0)) {
    printf("Inside if");
    }
    else {
    printf("Inside else");
    }
    return 0;
    }

    • @metheshortgirlishika
      @metheshortgirlishika 3 ปีที่แล้ว +1

      Output:-) inside if

    • @harshadatapre2133
      @harshadatapre2133 3 ปีที่แล้ว +1

      A. Inside if

    • @my_talks01
      @my_talks01 3 ปีที่แล้ว +1

      insideif

    • @arhitjoseph9681
      @arhitjoseph9681 2 ปีที่แล้ว +1

      @@my_talks01 how bro?

    • @my_talks01
      @my_talks01 2 ปีที่แล้ว +1

      @@arhitjoseph9681 a%2=1
      ! (a%2==0) condition is true because a%2 is not equal to zero, so body of if statement exicuted , hence we can say , "inside if" printed .

  • @toykeem
    @toykeem ปีที่แล้ว

    thank you programiz. the answer to the quiz question is option A

  • @3v1lm4nipul4t0r
    @3v1lm4nipul4t0r ปีที่แล้ว

    You are the best. You made fall inlove with proogramming

  • @Ech-chatouiMohammed
    @Ech-chatouiMohammed 4 หลายเดือนก่อน

    thank you for the explanation

  • @syedadil799
    @syedadil799 3 ปีที่แล้ว +1

    Very helpful

  • @someshjitu4546
    @someshjitu4546 3 ปีที่แล้ว +2

    Nice 👍

  • @cloudproblemssolved
    @cloudproblemssolved 9 หลายเดือนก่อน

    my answer for the question at the end:
    #include
    int main() {
    int number = -1;
    if(number == 0)
    printf("zero");
    else if(number > 0)
    printf("positive");
    else if(number < 0)
    printf("negative");
    return 0;
    }

  • @siddharth840
    @siddharth840 ปีที่แล้ว +1

    #include
    int main(){
    int num;
    printf("Enter the any number: ");
    scanf("%d", &num);
    if (num>0){
    printf("THE NUMBER IS POSITIVE");
    }
    else if (num==0){
    printf("THE NUMBER IS ZERO");
    }
    else{
    printf("THE NUMBER IS NEGATIVE");
    }
    return 0;
    }
    answer
    11:37

  • @Usmankhan-q8z5s
    @Usmankhan-q8z5s ปีที่แล้ว

    You are amazing ❤

  • @GideonMwangi-wp4up
    @GideonMwangi-wp4up 7 หลายเดือนก่อน

    Nyce program

  • @joyanvaso3251
    @joyanvaso3251 ปีที่แล้ว

    Can I ask, if you are going to run a program of if else statement uhhmm it's not needed to put a user input to it? Orrr yeah need to, I'm confuse😅

  • @hyuga290__
    @hyuga290__ 11 หลายเดือนก่อน

    #include
    int main()
    {
    double number;
    printf("Enter a number: ");
    scanf("%lf", &number);
    if (number > 0)
    {
    printf("The number is positive");
    }
    else if (number < 0)
    {
    printf("The number is negative");
    }
    else
    {
    printf("The number is 0");
    }
    return 0;
    }
    12:05

  • @JoshuaOgugua
    @JoshuaOgugua ปีที่แล้ว

    I love the simplicity

  • @victorcoded
    @victorcoded ปีที่แล้ว

    inside if
    great work

  • @saqibmalik5186
    @saqibmalik5186 2 ปีที่แล้ว +1

    thanks 💥😍

  • @d3vyn22
    @d3vyn22 ปีที่แล้ว

    u make c easy

  • @onic9623
    @onic9623 ปีที่แล้ว +1

    Option A : Inside if
    --------------------------------------------------------------
    #include
    int main()
    {
    int num;
    printf("Enter A Number: ");
    scanf("%d", &num);
    if (num == 0)
    {
    printf("The Number Is Zero");
    }
    else if (num > 0)
    {
    printf("The Number Is Positive");
    }
    else
    {
    printf("The Number Is Negative");
    }
    return 0;
    }

  • @blaugranalvent
    @blaugranalvent 2 ปีที่แล้ว

    thank you for your amazing work

  • @jaganr6351
    @jaganr6351 2 ปีที่แล้ว

    It is helpful,upload more videos mam

  • @samoboii
    @samoboii ปีที่แล้ว +1

    ANSWERS
    Task:
    double number;
    printf("please enter a number: ");
    scanf("%lf", &number);
    if (number > 0) {
    printf("this number is positive");
    }
    else if (number < 0) {
    printf("this number is negative");
    }
    else {
    printf("this number is 0");
    }
    Quiz:
    inside if

  • @syedadil799
    @syedadil799 3 ปีที่แล้ว +1

    Thanks a lot

  • @tambirogerenow5863
    @tambirogerenow5863 10 หลายเดือนก่อน

    Please can you make videos too on C++,java and python?

  • @iscentsfamily1936
    @iscentsfamily1936 2 ปีที่แล้ว

    great video

  • @kajialbums7421
    @kajialbums7421 ปีที่แล้ว

    its inside if, because the ! is logical not true and since the operative number is 0 than its right, unless the operative number is not 0. correct me if I missed something.

  • @levimulverhill6400
    @levimulverhill6400 ปีที่แล้ว

    Why does my compiler keep warning me that scanf() may be unsafe and forces me to use scanf_s()?

  • @crissl6738
    @crissl6738 ปีที่แล้ว

    Mine brings back both printf statements unless i remove the other if statement

  • @dayanandiiitd
    @dayanandiiitd ปีที่แล้ว

    what if i enter a character why its printing the number is positive?

  • @ALShareem
    @ALShareem 5 หลายเดือนก่อน

    her smile in start of video and at last oh my god just beautiful

  • @itsme_maniiee
    @itsme_maniiee ปีที่แล้ว

    Can we use ( else ) again n again ?

  • @Bahaa.shaalan
    @Bahaa.shaalan ปีที่แล้ว +1

    #include
    int main(void) {
    double tempareture=-12;
    if(tempareture>=1){
    printf("tempareture pasitive");
    }
    else if(tempareture

  • @Tatchim
    @Tatchim ปีที่แล้ว

    If possible please make similar tutorials for java and kotlin

  • @UddhavBanik
    @UddhavBanik 6 หลายเดือนก่อน

    Programming task :---
    #include
    int main()
    {
    double number;
    printf("Enter number : ");
    scanf("%lf",&number);
    if (number > 0)
    printf("The number is positive");
    else if(number < 0)
    printf("The number is negative");
    else if(number == 0)
    printf("The number is zero");
    return 0;
    }

  • @sirishasaragadam7603
    @sirishasaragadam7603 3 ปีที่แล้ว +2

    wt is the difference between if and else if

    • @programizstudios
      @programizstudios  3 ปีที่แล้ว

      else if condition is used in if else statement only if there are multiple conditions and else if condition is executed only "if condition" was false. There are many differences you can visit our tutorial to get more ideas. www.programiz.com/c-programming/c-if-else-statement

    • @sirishasaragadam7603
      @sirishasaragadam7603 3 ปีที่แล้ว

      @@programizstudios Thank u mam

  • @xhessa-e2h
    @xhessa-e2h 3 หลายเดือนก่อน

    thank you so much for this‚ it really help :,>

  • @meherubabintemahbub2423
    @meherubabintemahbub2423 ปีที่แล้ว

    You are awesome

  • @ishikasoni1305
    @ishikasoni1305 3 ปีที่แล้ว +1

    Ma'am plz upload videos fast it will be beneficial

  • @barkmiya2355
    @barkmiya2355 2 ปีที่แล้ว +4

    int num;
    printf("enter a number: ");
    scanf("%d",&num);
    if (num < 0 ) {
    printf("the number i s nagative ");
    }
    else if ( num >0 ) {
    printf("the number is possitive ");
    }
    else if (num = 0) {
    printf("the number is zero");
    }
    else {
    printf("you not entered a number plz inte a number ");
    }

  • @olisaemekaaghabuilo8688
    @olisaemekaaghabuilo8688 ปีที่แล้ว

    A. because the ! will evaluate the if condition to true thereby making the program print "inside if"

  • @ivzeee
    @ivzeee ปีที่แล้ว

    Thanks

  • @anasasif8714
    @anasasif8714 ปีที่แล้ว +1

    option A

  • @toufiqulislamtusar5265
    @toufiqulislamtusar5265 ปีที่แล้ว +1

    #include
    #include
    int main()
    {
    double number ;
    printf("Input number:");
    scanf("%lf",&number);
    if(number > 0){
    printf("The number is positive");
    }
    if(number == 0){
    printf("The number is zero");
    }
    if(number < 0){
    printf("The number is negetive");
    }
    }

  • @ankyhiggs1617
    @ankyhiggs1617 3 ปีที่แล้ว +2

    Mam plz upload videos daily

  • @shadhil3144
    @shadhil3144 3 ปีที่แล้ว +2

    Please upload a series tutoring java script

  • @Girma_Chew
    @Girma_Chew 2 ปีที่แล้ว +2

    // Online C compiler to run C program online
    /*This is a program to check whether a number is a positive, negative or a zero.*/
    #include
    int main()
    {
    double number;
    printf("Enter any number: ");
    scanf("%lf", &number);
    if(number>0)
    {
    printf("The number %.2lf is positive.",number);
    }
    if(number==0)
    {
    printf("The number %.2lf is Zero.",number);
    }
    if(number

  • @v.gkillergaming6973
    @v.gkillergaming6973 ปีที่แล้ว

    here the answer for your task mam thanks for teaching c easily
    #include
    int main()
    {
    double num;
    printf("enter the number :");
    scanf("%lf", &num);
    if(num > 0)
    {
    printf("positve");
    }
    if(num == 0)
    {
    printf("the number is 0");
    }

    else if(num

  • @kidsstorytime1573
    @kidsstorytime1573 2 ปีที่แล้ว +1

    Answer to quiz is A
    #include
    int main() {
    // Write C code here
    double number;
    printf("what is your number? ");
    scanf("%lf", &number);
    if(number > 0){
    printf("The number is positive");
    }
    if(number < 0){
    printf("The number is negative");
    }
    if(number ==0){
    printf("The number is 0");
    }
    return 0;
    }

  • @user-oh4ye3uv6j
    @user-oh4ye3uv6j 2 ปีที่แล้ว

    nice again yo

  • @subhajitNath0
    @subhajitNath0 3 ปีที่แล้ว +4

    Ma'am, it would have been nice to finish the course a little early

    • @programizstudios
      @programizstudios  3 ปีที่แล้ว +1

      Thank you! We appreciate your thoughts. We post video every week on Wednesday. So stay tuned for next video.

  • @TanakaMukwashi-ks4vj
    @TanakaMukwashi-ks4vj ปีที่แล้ว

    U are beautiful and good at ur work❤

  • @pristinewalek4578
    @pristinewalek4578 3 ปีที่แล้ว +2

    Answer is Inside if

  • @abisheks8287
    @abisheks8287 2 ปีที่แล้ว

    Instead of using if for the second time can't we just give a keyword default...? For printing " sorry you can't vote !! "...???

  • @ganeshbabubandi8886
    @ganeshbabubandi8886 2 ปีที่แล้ว +1

    b) inside else