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

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 410

  • @programizstudios
    @programizstudios  2 года назад +16

    Finding C programming hard? We’ve got you!
    🚀Get 60% off on Programiz PRO Lifetime Plan this Black Friday-pay once for skills that last forever. Don’t miss out, it’s a limited-time offer!
    👉Grab your discount now: bit.ly/blkfriday-24-yt

  • @miarose5382
    @miarose5382 2 года назад +108

    Answer is A : Inside if

  • @yunandaraung2556
    @yunandaraung2556 Год назад +58

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

  • @fountain9886
    @fountain9886 Год назад +32

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

  • @Tatchim
    @Tatchim Год назад +66

    #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 8 месяцев назад +1

      Good job

    • @danieldaniekl6222
      @danieldaniekl6222 Месяц назад

      else if(number

    • @najiibjama9906
      @najiibjama9906 Месяц назад

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

  • @srpcdgaming
    @srpcdgaming Год назад +15

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

    • @purpleocean5670
      @purpleocean5670 11 месяцев назад

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

    • @MeowwJane
      @MeowwJane 5 месяцев назад +2

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

  • @krishsharma162
    @krishsharma162 2 года назад +23

    Ma'am, these lectures are very helpful.

  • @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.

  • @AlaskarAbdoul
    @AlaskarAbdoul Год назад +16

    /*
    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;
    }

  • @nickjonaz3710
    @nickjonaz3710 Год назад +3

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

  • @With.h
    @With.h Год назад +3

    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

  • @julia512
    @julia512 10 дней назад +1

    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

  • @MarkjonelDumlao
    @MarkjonelDumlao Месяц назад +1

    Better explanation than my professor teacher😊

  • @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.

  • @aysham.8398
    @aysham.8398 Год назад +2

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

  • @emmydee408
    @emmydee408 Год назад +2

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

  • @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

  • @akibiswhere
    @akibiswhere Год назад +1

    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

  • @alirezaz9896
    @alirezaz9896 2 года назад +4

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

  • @henryalbrightekenimdeokpos905
    @henryalbrightekenimdeokpos905 5 месяцев назад +1

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

  • @MadCrusherYT_006
    @MadCrusherYT_006 Месяц назад

    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

  • @boramawi
    @boramawi 2 года назад +2

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

  • @Darkness-898
    @Darkness-898 5 месяцев назад +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;
    }

  • @raghumanda2tanush496
    @raghumanda2tanush496 2 года назад +3

    really helpful course , simple and effective explanation

  • @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.]

  • @AmanGupta-zp5xi
    @AmanGupta-zp5xi Год назад +2

    Thank you mam, you have explained wonderfully 😊

  • @youngsunday8192
    @youngsunday8192 Год назад

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

  • @like_a_boss881
    @like_a_boss881 Год назад +3

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

  • @islemkhelifa-ve7ip
    @islemkhelifa-ve7ip Год назад

    inside if , thank you teacher, you are the best

  • @h.d4632
    @h.d4632 3 месяца назад +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

  • @uppilipavitra9634
    @uppilipavitra9634 5 месяцев назад

    #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

  • @flick-ict2276
    @flick-ict2276 2 года назад +4

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

  • @Kevin-w9w
    @Kevin-w9w 2 месяца назад

    So easy to understand thanks

  • @toykeem
    @toykeem Год назад

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

  • @tanmaykumartewary2166
    @tanmaykumartewary2166 2 года назад +2

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

  • @mondmare9712
    @mondmare9712 7 месяцев назад

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

  • @okolieolisafrancis3292
    @okolieolisafrancis3292 Месяц назад

    Am inspired and it is wonderful

  • @tambirogerenow5863
    @tambirogerenow5863 7 месяцев назад

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

  • @LearnEnglishThrough_Podcast
    @LearnEnglishThrough_Podcast 2 года назад +1

    Amazing explanation

  • @paulmuchemwa7950
    @paulmuchemwa7950 2 года назад +1

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

  • @Ech-chatouiMohammed
    @Ech-chatouiMohammed 2 месяца назад

    thank you for the explanation

  • @nihatdonmzov4166
    @nihatdonmzov4166 2 года назад +2

    Thank you so much🙂

  • @cloudproblemssolved
    @cloudproblemssolved 6 месяцев назад

    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;
    }

  • @UddhavBanik
    @UddhavBanik 4 месяца назад

    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;
    }

  • @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

  • @Bahaa.shaalan
    @Bahaa.shaalan Год назад +1

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

  • @ALShareem
    @ALShareem 2 месяца назад

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

  • @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");
    }
    }

  • @raghavendrarao6973
    @raghavendrarao6973 2 года назад +2

    thanks a lot maam , your videos are very helpful

  • @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;
    }

  • @ishikasoni1305
    @ishikasoni1305 2 года назад +1

    Ma'am plz upload videos fast it will be beneficial

  • @flashman6620
    @flashman6620 2 года назад +2

    It,s amazing
    thank you for your efforts

  • @ankyhiggs1617
    @ankyhiggs1617 2 года назад +2

    Mam plz upload videos daily

  • @3v1lm4nipul4t0r
    @3v1lm4nipul4t0r Год назад

    You are the best. You made fall inlove with proogramming

  • @ritiksingh1484
    @ritiksingh1484 2 года назад +1

    Love Your Voice ☺

  • @tambirogerenow5863
    @tambirogerenow5863 7 месяцев назад

    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

  • @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;
    }

  • @olisaemekaaghabuilo8688
    @olisaemekaaghabuilo8688 Год назад

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

  • @JoshuaOgugua
    @JoshuaOgugua Год назад

    I love the simplicity

  • @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

  • @sychok958
    @sychok958 2 года назад +1

    Video is helpful and understadable~~thanksss a lot

  • @d3vyn22
    @d3vyn22 Год назад

    u make c easy

  • @victorcoded
    @victorcoded Год назад

    inside if
    great work

  • @pristinewalek4578
    @pristinewalek4578 2 года назад +2

    Answer is Inside if

  • @gogulram2551
    @gogulram2551 2 года назад +6

    #include
    int main() {
    double number;
    printf("enter the 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;
    } the program u asked to do by us

  • @shadhil3144
    @shadhil3144 2 года назад +2

    Please upload a series tutoring java script

  • @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 ");
    }

  • @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

  • @subhajitNath0
    @subhajitNath0 2 года назад +4

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

    • @programizstudios
      @programizstudios  2 года назад +1

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

  • @samsothsanjay9696
    @samsothsanjay9696 2 года назад +2

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

  • @Tatchim
    @Tatchim Год назад

    If possible please make similar tutorials for java and kotlin

  • @devarapallivamsi2981
    @devarapallivamsi2981 2 года назад

    #include
    int main() {
    printf("Thank you programiz team");
    return 0;
    }

  • @syedadil799
    @syedadil799 2 года назад +1

    Very helpful

  • @syedadil799
    @syedadil799 2 года назад +1

    Thanks a lot

  • @shivamchauhan6404
    @shivamchauhan6404 2 года назад +1

    // Online C compiler to run C program online
    #include
    int main() {
    // Write C code here
    double number;
    printf("Enter the number here:");
    scanf("%lf", &number);
    if(number>0){
    printf("The number is positive");

    }
    else if(number == 0){
    printf("The number is 0");
    }
    else{
    printf("The number is negative");
    }

    return 0;
    }
    OUTPUT:
    Enter the number here: -18
    The number is negative

  • @someshjitu4546
    @someshjitu4546 2 года назад +2

    Nice 👍

  • @subhajitNath0
    @subhajitNath0 2 года назад +3

    Ma'am, it would be nice to post a video a week early

  • @jaganr6351
    @jaganr6351 2 года назад

    It is helpful,upload more videos mam

  • @ehathesham_003
    @ehathesham_003 2 года назад +1

    answer is "Inside if" option:A

  • @anasasif8714
    @anasasif8714 Год назад +1

    option A

  • @doctor2345
    @doctor2345 11 месяцев назад

    extremely helpful. keep it up!

  • @ganeshbabubandi8886
    @ganeshbabubandi8886 2 года назад +1

    b) inside else

  • @pratibhasrivastav2698
    @pratibhasrivastav2698 Год назад

    My solution-
    #include
    int main() {
    double input;
    printf(Enter decimal: );
    scanf("%lf",&input);
    if (input == 0){
    printf("The number is 0.");
    }
    else if(input>0){
    printf("The number is positive.");
    }
    else{
    printf("The number is negetive.");
    }
    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

  • @sriram-qz3bc
    @sriram-qz3bc 2 года назад +2

    The answer is option A

  • @Project.i
    @Project.i 7 месяцев назад

    //to display whether the entered number is positive or negative
    #include
    int main()
    {
    double number;
    printf("enter the number: ");
    scanf("%lf", &number);
    if (number > 0){
    printf("The entered number is positive");
    }
    else if (number < 0){
    printf("The entered number is negative");
    }
    else {
    printf("The entered number is zero");
    }
    return 0;
    }

  • @programizstudios
    @programizstudios  2 года назад +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 2 года назад +1

      Output:-) inside if

    • @harshadatapre2133
      @harshadatapre2133 2 года назад +1

      A. Inside if

    • @my_talks01
      @my_talks01 2 года назад +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 .

  • @hyuga290__
    @hyuga290__ 9 месяцев назад

    #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

  • @shs119
    @shs119 6 месяцев назад

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

  • @ranjithn7191
    @ranjithn7191 2 года назад +4

    double number=20.8;
    if(number>0){
    printf("The number is positive");
    }
    else if(number

  • @Usmankhan-q8z5s
    @Usmankhan-q8z5s Год назад

    I really inspired to your lecture ❤

  • @itsme_maniiee
    @itsme_maniiee Год назад

    Can we use ( else ) again n again ?

  • @joyanvaso3251
    @joyanvaso3251 11 месяцев назад

    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😅

  • @vincemichaelgudito8734
    @vincemichaelgudito8734 2 года назад +1

    // Online C compiler to run C program online
    #include
    int main() {
    double number;
    printf("Enter a number:\t");
    scanf("%lf", &number);
    if(number > 0){
    printf("the number is positive");
    }
    else if (number == 0){
    printf("the number is zero");
    }
    else if (number < 0){
    printf("the number is negative");
    }
    return 0;
    }

  • @saqibmalik5186
    @saqibmalik5186 2 года назад +1

    thanks 💥😍

  • @Data2watch
    @Data2watch Год назад

    // program to check the number is +ve , -ve or 0
    #include
    int main()
    {
    float num;
    printf("Enter the number
    ");
    scanf("%f",&num);
    if(num>0)
    {
    printf("It is positive number
    ");
    }
    else if(num

  • @manindrapraharaj873
    @manindrapraharaj873 2 года назад +1

    // Online C compiler to run C program online
    #include
    int main() {
    double age ;
    printf("pls enter the age
    ");
    scanf("%lf",&age);
    printf("the value of age is %lf",age);
    if (age>0)
    {
    printf("
    the number is positive");
    }
    else if (age

  • @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.

  • @bandulajagathkumara1038
    @bandulajagathkumara1038 Год назад

    #include
    int main(void) {
    // Variable deceleration
    int num;
    // User inputs
    printf("Enter a number : ");
    scanf("%d",&num);
    // Condition 01
    if(num > 0) {
    printf("number %d is positive",num);
    }
    // Condition 02
    else if(num < 0){
    printf("number %d is negative",num);
    }
    // Condition 03
    else if(num == 0){
    printf("number %d is equal to 0",num);
    }
    }