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

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 411

  • @programizstudios
    @programizstudios  2 роки тому +17

    🚀 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 роки тому +65

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

  • @Tatchim
    @Tatchim Рік тому +68

    #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 9 місяців тому +1

      Good job

    • @danieldaniekl6222
      @danieldaniekl6222 2 місяці тому

      else if(number

    • @najiibjama9906
      @najiibjama9906 Місяць тому

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

  • @miarose5382
    @miarose5382 3 роки тому +110

    Answer is A : Inside if

  • @fountain9886
    @fountain9886 Рік тому +33

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

  • @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 6 місяців тому +5

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

  • @krishsharma162
    @krishsharma162 3 роки тому +23

    Ma'am, these lectures are very helpful.

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

  • @erl2nd
    @erl2nd 2 роки тому +34

    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.

  • @julia512
    @julia512 Місяць тому +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

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

  • @nickjonaz3710
    @nickjonaz3710 Рік тому +3

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

  • @neetdiagramacticlearning4173
    @neetdiagramacticlearning4173 2 роки тому +1

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

  • @Darkness-898
    @Darkness-898 6 місяців тому +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;
    }

  • @emmydee408
    @emmydee408 Рік тому +2

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

  • @henryalbrightekenimdeokpos905
    @henryalbrightekenimdeokpos905 6 місяців тому +1

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

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

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

  • @MarkjonelDumlao
    @MarkjonelDumlao Місяць тому +1

    Better explanation than my professor teacher😊

  • @alirezaz9896
    @alirezaz9896 2 роки тому +4

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

  • @TewodrosBaye1
    @TewodrosBaye1 Рік тому +3

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

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

  • @MadCrusherYT_006
    @MadCrusherYT_006 2 місяці тому

    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

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

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

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

  • @boramawi
    @boramawi 2 роки тому +2

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

  • @Bahaa.shaalan
    @Bahaa.shaalan Рік тому +1

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

  • @h.d4632
    @h.d4632 4 місяці тому +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

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

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

  • @hyuga290__
    @hyuga290__ 10 місяців тому

    #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

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

  • @UddhavBanik
    @UddhavBanik 5 місяців тому

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

  • @uppilipavitra9634
    @uppilipavitra9634 6 місяців тому

    #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

  • @mondmare9712
    @mondmare9712 8 місяців тому

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

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

  • @tanmaykumartewary2166
    @tanmaykumartewary2166 3 роки тому +2

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

  • @paulmuchemwa7950
    @paulmuchemwa7950 2 роки тому +1

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

  • @islemkhelifa-ve7ip
    @islemkhelifa-ve7ip Рік тому

    inside if , thank you teacher, you are the best

  • @tambirogerenow5863
    @tambirogerenow5863 8 місяців тому

    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

  • @ritiksingh1484
    @ritiksingh1484 2 роки тому +1

    Love Your Voice ☺

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

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

  • @cloudproblemssolved
    @cloudproblemssolved 7 місяців тому

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

  • @toykeem
    @toykeem Рік тому

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

  • @flashman6620
    @flashman6620 2 роки тому +2

    It,s amazing
    thank you for your efforts

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

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

  • @LearnEnglishThrough_Podcast
    @LearnEnglishThrough_Podcast 2 роки тому +1

    Amazing explanation

  • @nihatdonmzov4166
    @nihatdonmzov4166 2 роки тому +2

    Thank you so much🙂

  • @bandulajagathkumara1038
    @bandulajagathkumara1038 2 роки тому

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

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

  • @plasmageorge4944
    @plasmageorge4944 Рік тому +1

    Thank you

  • @3v1lm4nipul4t0r
    @3v1lm4nipul4t0r Рік тому

    You are the best. You made fall inlove with proogramming

  • @sychok958
    @sychok958 2 роки тому +1

    Video is helpful and understadable~~thanksss a lot

  • @raghavendrarao6973
    @raghavendrarao6973 3 роки тому +2

    thanks a lot maam , your videos are very helpful

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

  • @ALShareem
    @ALShareem 3 місяці тому

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

  • @Kevin-w9w
    @Kevin-w9w 3 місяці тому

    So easy to understand thanks

  • @abhilashreddymalikireddy
    @abhilashreddymalikireddy Рік тому

    #include
    #include
    int main(){
    int num= -2;
    if(num >=1){
    printf("positive");
    }
    else if(num

  • @okolieolisafrancis3292
    @okolieolisafrancis3292 2 місяці тому

    Am inspired and it is wonderful

  • @fountain9886
    @fountain9886 Рік тому +1

    #include
    int main()
    {
    double number;
    printf("Enter Your Number :");
    scanf("%lf",number);
    if (number>=0){
    printf("Number is Positive");
    }
    else if (number

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

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

  • @JoshuaOgugua
    @JoshuaOgugua Рік тому

    I love the simplicity

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

  • @pawans.3766
    @pawans.3766 2 роки тому +1

    #include
    int main(){
    float number;
    printf("enter a number");
    scanf("%f",&number);
    if(number>0){
    printf("the number id +ve");
    }
    else if(number

  • @Ech-chatouiMohammed
    @Ech-chatouiMohammed 3 місяці тому

    thank you for the explanation

  • @Usmankhan-q8z5s
    @Usmankhan-q8z5s Рік тому

    I really inspired to your lecture ❤

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

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

  • @doctor2345
    @doctor2345 Рік тому

    extremely helpful. keep it up!

  • @Project.i
    @Project.i 8 місяців тому

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

  • @someshjitu4546
    @someshjitu4546 2 роки тому +2

    Nice 👍

  • @d3vyn22
    @d3vyn22 Рік тому

    u make c easy

  • @amphorashaven7258
    @amphorashaven7258 2 роки тому +2

    #include
    int main() {
    // This code checks if a number is positive or negative or zero
    double number;
    printf("Enter a 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;
    }

    • @erl2nd
      @erl2nd 2 роки тому

      Well Done
      Thanks 😊

  • @ankyhiggs1617
    @ankyhiggs1617 3 роки тому +2

    Mam plz upload videos daily

  • @tambirogerenow5863
    @tambirogerenow5863 8 місяців тому

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

  • @anasasif8714
    @anasasif8714 Рік тому +1

    option A

  • @shs119
    @shs119 7 місяців тому

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

  • @ishikasoni1305
    @ishikasoni1305 3 роки тому +1

    Ma'am plz upload videos fast it will be beneficial

  • @syedadil799
    @syedadil799 2 роки тому +1

    Very helpful

  • @saqibmalik5186
    @saqibmalik5186 2 роки тому +1

    thanks 💥😍

  • @olisaemekaaghabuilo8688
    @olisaemekaaghabuilo8688 Рік тому

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

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

  • @victorcoded
    @victorcoded Рік тому

    inside if
    great work

  • @pristinewalek4578
    @pristinewalek4578 3 роки тому +2

    Answer is Inside if

  • @AkunemeMighty
    @AkunemeMighty Рік тому

    int main() {
    double num;
    printf("Enter a number: ");
    scanf("%lf", &num);
    if (num >= 1)
    {
    printf("The number is positive");
    } else if (num < 0)
    {
    printf("The number is negative");
    } else {
    printf("Number is 0");
    }



    return 0;
    }

  • @TinovimbanasheKasiyamhuru
    @TinovimbanasheKasiyamhuru 9 місяців тому

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

  • @Usmankhan-q8z5s
    @Usmankhan-q8z5s Рік тому

    You are amazing ❤

  • @BeLikeSairaj
    @BeLikeSairaj 4 місяці тому +1

    #include
    int main () {

    double number;
    printf("Enter the number: ");
    scanf("%lf", &number);
    if (number==0) {
    printf("
    The Number is neutral!");
    }
    else if (number

  • @shadhil3144
    @shadhil3144 3 роки тому +2

    Please upload a series tutoring java script

  • @simautomation
    @simautomation 2 роки тому

    #include
    int main() {
    int num;
    printf ("enter the number: ");
    scanf ("%d", &num);
    if (num >0)
    printf ("The number is Positive");
    else if (num

  • @jaganr6351
    @jaganr6351 2 роки тому

    It is helpful,upload more videos mam

  • @GideonMwangi-wp4up
    @GideonMwangi-wp4up 6 місяців тому

    Nyce program

  • @jp23x
    @jp23x 5 місяців тому

    double number;
    printf("choose 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
    ");
    }