Switch Case Control Statements In C: C Tutorial In Hindi #11

Sdílet
Vložit
  • čas přidán 27. 04. 2019
  • In this c programming tutorial video, I have explained you about if else conditionals in c and examples of the same in c. I hope you are enjoying this C course in Hindi.
    ►This C Lecture is a part of this C Programming Course: • C Language Tutorials I...
    ►Source Code + Notes: codewithharry....
    ►Click here to subscribe - / @codewithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Learn Python In Hindi ...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithha...
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

Komentáře • 1,6K

  • @CodeWithHarry
    @CodeWithHarry  Před 5 lety +706

    Hope sab samajh me aa raha hai!
    Is this course going slow or fast????? Please please reply me??? I am getting mixed feedback. Thanks a lot!

  • @NitinKumar-gq7yr
    @NitinKumar-gq7yr Před rokem +268

    #include
    int main()
    {
    int day_no;
    printf("enter day_no
    ");
    scanf("%d",&day_no);
    switch (day_no)
    {
    case 1:
    printf("monday
    ");
    break;
    case 2:
    printf("tuesday
    ");
    break;
    case 3:
    printf("wednesday
    ");
    break;
    case 4:
    printf("thrusday
    ");
    break;
    case 5:
    printf("friday
    ");
    break;
    case 6:
    printf("saturday
    ");
    break;
    case 7:
    printf("sunday
    ");
    break;
    default :
    printf("input must be between 1-7
    ");
    }
    return 0;

    }

  • @iitduniya
    @iitduniya Před 6 měsíci +119

    Kon kon 2024 me dekh raha hai❤❤

  • @ls12394
    @ls12394 Před rokem +98

    Code using Switch for Speed of vehicle
    #include
    int main()
    {
    int speed;
    printf("Enter your speed
    ");
    scanf("%d", &speed);
    switch (speed)
    {
    case 40:
    printf("Your speed is 40");
    break;
    case 50:
    printf("Your speed is 50");
    break;
    case 60:
    printf("Your speed is 60");
    break;
    default:
    printf("Your speed is not 40, 50 or 60");

    }
    return 0;
    }

  • @dnyaneshwargaikwad6788
    @dnyaneshwargaikwad6788 Před 2 lety +55

    {
    int score;
    printf("Enter your score
    ");
    scanf("%d",&score);
    switch(score)
    {
    case 12:
    printf("your score is 12");
    break;
    case 16:
    printf("your score is 16");
    break;
    default:
    printf("your score is not 12 or 16");

    }
    return 0;
    }

  • @shubhamjaiswal2322
    @shubhamjaiswal2322 Před 5 lety +27

    Bhai C padhi hai but use refresh krni thi but aap padha rhe ho toh shuru se padhne me jyada maja aa raha hai
    Thank you keep it up.

  • @sineparadox98
    @sineparadox98 Před 2 lety +5

    Harry bhai aapke teaching ka tareeka ek dum unique and elementary hai. Aap koi bhi concepts samjhate ho to bohot achche se aur ideal proof ke saath teach karate ho usko easily breakdown karke. Thank you so much.

  • @vindeshshukla4079
    @vindeshshukla4079 Před rokem +3

    #include
    int main()
    {
    int marks;
    printf ("enter your marks
    ");
    scanf("%d",&marks);
    Switch (marks)
    {
    Case 45:
    printf("your marks is 45");
    break;
    Case 99:
    printf ("your marks is 99");
    break;
    default:
    printf ("your marks is not 45 and 99");
    break;
    }
    return 0;
    }

  • @chaudharyshoeb8459
    @chaudharyshoeb8459 Před 4 lety +9

    Hello brother,
    You r doing a great job.
    As per your question ,The course is going fast but then to getting it understand by repeating the video
    My Switch program
    #include
    int main()
    {
    int marks;
    printf("enter your marks
    ");
    scanf("%d", &marks);
    switch (marks)
    {
    case 10:
    printf("your marks is 10
    ");
    break;
    case 20:
    printf("your marks is 20
    ");
    break;
    default:
    printf("your mark is not 10,20");
    }
    return 0;
    }

  • @nikhilraj1842
    @nikhilraj1842 Před 5 lety +187

    // Challenge accepted
    /*
    author:Nikhil Raj
    purpose:To learn Switch Cases
    date:18/06/2019
    */
    #include
    int main(){
    int kitnepanipuris;
    scanf("%d",&kitnepanipuris);
    switch (kitnepanipuris)
    {
    case 0:
    printf("Bhaiya 10 ke
    ");
    break;
    case 2:
    printf("Thode aur khilao
    ");
    break;
    case 4:
    printf("Thik hae bhia kitna hua
    ");
    break;
    default:
    printf("Ache Pani puri hae");
    break;
    }
    return 0;
    }

  • @basitshykh756
    @basitshykh756 Před 2 lety +144

    sir i am from pakistan and matric class student.sir your teaching pattern is so clearly.clearly that way because you teach everthing that could be important to us with the help of your videos you teaching your subscriber everything that they want and free of cost .this is one of the best platfarm where they founds every videos

    • @nikhilanand3447
      @nikhilanand3447 Před 2 lety +60

      Bro your English tells us that you are Pakistani

    • @professor2250
      @professor2250 Před 2 lety +22

      @@nikhilanand3447 bro your face tells us you are Indian

    • @anshumanraturi
      @anshumanraturi Před 2 lety +47

      @@nikhilanand3447 not ethical for anybody to troll anyone for his/her second language. English doesnot bring wisdom u proved it. May u get wisdom.

    • @parmardharmik4731
      @parmardharmik4731 Před 2 lety

      @@nikhilanand3447 bro tuje itani hi ENGLISH aati hai to tu jake usse sikha
      Tere ma -baap ko teri jitani English aati hai kya??????????

    • @memematerial4205
      @memematerial4205 Před 2 lety +2

      Welcome bro

  • @uditnathprasad5612
    @uditnathprasad5612 Před 4 měsíci +7

    #include
    int main()
    {
    int temp;
    printf("Enter the temperature in degree Celsius");
    scanf("%d",&temp);
    switch(temp)
    {
    case 40:
    printf("Hot
    ");
    break;
    case 10:
    printf("Cold
    ");
    default:
    printf("Invalid input");
    }
    return 0;
    }

  • @ajaymohankar5912
    @ajaymohankar5912 Před 4 lety +64

    #include
    int main()
    {
    int age,percent;
    printf("ENTER YOUR AGE BETWEEN 10 TO 15
    ");
    scanf("%d",&age);
    switch (age)
    {
    case 10:
    printf("you should be in 5th class now
    ");

    break;
    case 11:
    printf("you should be in 6th class now");

    break;
    case 12:
    printf("you should be in 7th class now");

    break;
    case 13:
    printf("you should be in 8th class now");

    break;
    case 14:
    printf("you should be in 9th class now");

    break;
    case 15:
    printf("you should be in 10th class now");

    break;
    default:
    printf("i have no information about this age class");
    break;
    }
    return 0;
    }

    • @abdularhamjamal8957
      @abdularhamjamal8957 Před 3 lety +19

      percent variable is useless....you didn't use it ..in 4th line (int age,percent;) should be (int age;)😄

    • @1plusspace568
      @1plusspace568 Před 2 lety +1

      should be in 4th line
      Scanf("%d", &age,& percent);

    • @CEB-AMITKUMAR
      @CEB-AMITKUMAR Před 2 lety +4

      Bro If by default has executed then break no needed I think 🤔

    • @shivamchopra9885
      @shivamchopra9885 Před 2 lety +1

      This program is not executed

    • @Sunny-qy1fj
      @Sunny-qy1fj Před 2 lety +3

      you need to take another switch in every case and put percent according too your mind

  • @tuneflix7252
    @tuneflix7252 Před 2 lety +12

    #include
    int main () {
    int a;
    printf("your roll no is ") ;
    Scanf("%d", &a) ;
    Switch (a) {
    Case 1:
    printf(" Your name is prachi") ;
    break;
    Case 2:
    printf(" Your name is sakshi") ;
    break;
    Case 3:
    printf(" Your name is Tushar") ;
    break;
    default :
    printf("roll no is incorrect") ;
    break;
    }
    return 0;
    }

  • @adityaa8410
    @adityaa8410 Před rokem +2

    sample program for switch case (nested):
    #include
    int main()
    {
    int b,class;
    printf("enter a number b:
    ");
    scanf("%d",&b);
    printf("enter your class:
    ");
    scanf("%d",&class);
    switch (b)
    {
    case (45):
    printf("the value is 45
    ");
    switch (class)
    {
    case (12):
    printf("your in class 12
    ");
    break;

    default:
    break;
    }
    break;

    case(35):
    printf("the value is 35");
    default:
    break;
    }
    return 0;
    }

  • @24_cst3_eshagunjekar7
    @24_cst3_eshagunjekar7 Před 3 lety +26

    As a beginner I was unable to understand .But your vidoes are seriously soo good, very easy to understand ❤ Also thankyou for your vlogs.

  • @mohitverma4777
    @mohitverma4777 Před 4 lety +42

    #include
    int main()
    {
    int a;
    printf("Please Enter
    1 if you are passed in maths
    2 if you are passed in science
    3 if you are passed in both maths and science
    And 4 if you are passed in none
    ");
    scanf("%d",&a);
    switch (a)
    {
    case 1 :
    printf("You have won rs.15
    ");
    break;
    case 2 :
    printf("You have won rs.15
    ");
    break;
    case 3 :
    printf("You have won rs.45
    ");
    break;
    default:
    printf("Work Hard!!!!");
    break;
    }

    return 0;
    }

  • @SA-ox9zi
    @SA-ox9zi Před 5 lety +45

    Best course on C I found on youtube after long research. You teach in a very intuitive way with appropriate practical examples and exercises and quizzes.

  • @preetmonga436
    @preetmonga436 Před rokem +11

    Code for checking whether a triangle is right angled or not
    #include
    int main()
    {
    int A,H,P,B;
    printf("Enter the length of sides of triangle
    Enter larger length first
    ");
    scanf("%d%d%d",&H,&B,&P);
    A = H*H - (B*B +P*P);
    switch(A)
    {
    case 0 :
    printf("Triangle is Right angled triangle");
    break;
    default :
    printf("Triangle is not Right angled");
    }
    return 0;
    }

    • @yashshukla9590
      @yashshukla9590 Před rokem

      what if i entered base insted of hypotenuse in the first place

    • @preetmonga436
      @preetmonga436 Před rokem

      @@yashshukla9590 that's why i wrote their to enter larger side first i.e. hypotenuse

    • @dorothy4407
      @dorothy4407 Před 11 měsíci

      Ur code means if area is 0 it's a right angled?? That doesn't make sense, explain pls

    • @preetmonga436
      @preetmonga436 Před 11 měsíci +2

      @@dorothy4407 Area is not used. A is not area but a variable to check validity of Pythagoras theorem. We can add another case for that if the sides zero that means it is a point.

    • @titlegamerz8156
      @titlegamerz8156 Před 10 měsíci

      This code won't show any output
      👇🏻 This is the right code
      #include
      int main() {
      int A,H,P,B;
      printf ("enter the length of the sides of a triangle
      First enter the largest ones length
      ");
      scanf("%d,%d,%d",&H,&P,&B);
      printf("A=%d
      ",H*H-(P*P+B*B),&A);
      switch(A)
      {
      case 0:
      printf("this is a rightangled triangle
      ");
      break;
      default:
      printf("this is not a right angled triangle");
      }
      return 0;
      }

  • @rajasaha4906
    @rajasaha4906 Před 4 lety +57

    #include
    void main()
    {int a;
    printf("witch subject u have passed
    ");
    printf("for math press 1
    for scince press 2
    for scince & math press 3
    ");
    scanf("%d",&a);
    switch (a)
    {
    case 1:
    printf("u got $15");
    break;
    case 2:
    printf("u got $15");
    break;
    default:
    printf("u got $45");
    }
    }

    • @keshawchoudhary
      @keshawchoudhary Před 2 lety +6

      if the user put 4 or any other key then ur program can't show any result. I suggest for any other key its show invalid key for this u put default as invalid input and add case 3. Then ur program is more better. Thank u

    • @sabhadpiyush7563
      @sabhadpiyush7563 Před 2 lety +1

      I don't find any sense 😐

    • @pruthvirajbhonge7720
      @pruthvirajbhonge7720 Před 2 lety

      Your code is. Invalid

    • @karansolav7275
      @karansolav7275 Před 2 lety

      error aayenga return 0 kon likhenga !

    • @maazshaikh3708
      @maazshaikh3708 Před 2 lety +1

      @@karansolav7275 its not at all necessary

  • @imamuddinansari2917
    @imamuddinansari2917 Před 5 lety +25

    aap itna achhe se smjhate h fir bhi aap ke video pr likes kam q aate h ?
    aapke sabhi videos superb h 👌👌👌👌👍👍👍👍

  • @arjunkendre4656
    @arjunkendre4656 Před 5 lety +30

    #include
    int main()
    {
    int age;
    scanf("%d
    ", &age);
    printf("enter your age
    ",age);
    switch(age)
    {
    case 2:printf("your age is 45");
    break;
    case 3:printf("your age is below 30");
    break;
    default:printf("your age is not match");
    }
    return 0;
    }
    My code I am beginner

    • @akashagrawal2645
      @akashagrawal2645 Před 3 lety +1

      🙄 if person input 2 then it will show your age is 45 I think so you should improve this one 🙏

    • @nileshrajbhar9263
      @nileshrajbhar9263 Před 3 lety +4

      Printf will come before scanf u should improve this thing also 🙏🙏😊😊

    • @nileshrajbhar9263
      @nileshrajbhar9263 Před 3 lety +1

      I am also a beginner 👍👍🤘🤞

    • @SUNNYVLOGS812
      @SUNNYVLOGS812 Před 3 lety

      Bro if a person input his /her age 2 then account to your program he's 45 year old :(

  • @collagelife8953
    @collagelife8953 Před 9 měsíci +1

    #include
    int main()
    {
    int age;
    printf("Enter your age
    ");

    scanf("%d", &age);
    switch(age)
    {
    case 3:
    printf("the age is 3
    ");
    break;
    case 13:
    printf("the age is 13
    ");
    break;
    case 23:
    printf("the age is 23
    ");
    break;
    default:
    printf("Age is not 3 , 13 or 23
    ");
    break;

  • @SadamHussain-zj9ei
    @SadamHussain-zj9ei Před 5 lety +73

    Hi Sir, Great Explanation of switch statement. Thank you so much.

    • @CodeWithHarry
      @CodeWithHarry  Před 5 lety +35

      Thanks Sadam!

    • @SadamHussain-zj9ei
      @SadamHussain-zj9ei Před 5 lety +2

      Sir, aap awar exercise banaye ge. Bahut maza hai ex main.

    • @hindishorts593
      @hindishorts593 Před 4 lety +9

      @@CodeWithHarry Harry bhaiya jo aapne practice ke liye work diya tha c program ka jisame : math=15, science=15, math& science=45 prize Dena tha
      Value me math science dalne par error Bata Raha hai but nomber dalne par run karta hai
      ye mujhe
      samajh me nahi aa Raha hai
      Please mujhe jarur bataiyega

    • @karateandextratips4487
      @karateandextratips4487 Před 3 lety

      @@hindishorts593 same here bro

    • @karateandextratips4487
      @karateandextratips4487 Před 3 lety

      @@hindishorts593 pls solve this problem bhai

  • @sonalibachhav9229
    @sonalibachhav9229 Před 3 lety +54

    I think you are the master in c programming language , great explanation thanks "a lot"

  • @achyutagrahari2008
    @achyutagrahari2008 Před 2 lety +22

    /* Date-5/1/2022
    Author Name-Achyut Agrahari
    Purpose=for Learning Code
    The code is about switch satements*/
    int main()
    {
    int a;
    printf("Cutoff For Admission In BCA
    " );
    printf("Enter your category code
    ");
    printf("Enter 1 for unreserved category
    ");
    printf("Enter 2 for EWS category
    ");
    printf("Enter 3 for OBC category
    ");
    printf("Enter 4 for SC/ST category
    ");
    scanf("%d",&a);
    switch (a)
    {
    case 1:
    printf("Enter your marks
    ");
    scanf("%d",&a);
    if (a>=160)
    {
    printf("you are selecteted
    ");
    }
    else
    printf("Wait for next cutoff
    ");
    break;
    case 2:
    printf("Enter your mark
    ");
    scanf("%d",&a);
    if (a>=150)
    {
    printf("you are selecteted
    ");
    }
    else
    printf("Wait for next cutoff
    ");
    break;
    case 3:
    printf("Enter your mark
    ");
    scanf("%d",&a);
    if (a>=142)
    {
    printf("you are selecteted
    ");
    }
    else
    printf("Wait for next cutoff
    ");
    break;
    case 4:
    printf("Enter your mark
    ");
    scanf("%d",&a);
    if (a>=125)
    {
    printf("you are selecteted
    ");
    }
    else if (a>=100)
    {
    printf("you are selecteted through ST catgory
    ");
    }
    else
    printf("Wait for next cutoff
    ");
    break;
    default:
    printf("Error
    ");
    }
    }

  • @anshumanacharya9812
    @anshumanacharya9812 Před 11 měsíci +2

    #include
    int main()
    {
    int marks;
    printf("Enter your marks in programming and data structures");
    scanf("%d",&marks);
    switch(marks)
    {case(90):
    printf("GOOD
    ");
    break;
    default:
    printf("Focus on your weaknesses
    ");
    break;
    }
    printf("End
    ");
    return 0
    }

  • @mridulamal7748
    @mridulamal7748 Před rokem +5

    #include
    Int main( )
    {
    Int age;
    Printf("enter your age :");
    Scanf("%d",&age );
    Switch(age ){
    Case 18 :
    Printf(" preadult ");
    break
    Case 10:
    Printf("young");
    break;
    Case 60:
    Printf("old");
    default :
    Prrintf("invalid age ");
    }
    return 0;
    }

  • @nihaltabbalaji5340
    @nihaltabbalaji5340 Před 2 lety +5

    #include
    Int main()
    {
    Int age, weight;
    Printf("enter the age
    ");
    Scanf("%d",age);
    Printf("Enter the weight
    ");
    Scanf("%d",weight);
    Switch (age)
    Case14
    Printf(" the age is 14");
    Switch( Weight)
    Case 27
    Printf("Enter the weight");
    Break;
    Default
    Printf("the age and weight are match");
    }

  • @PR_Pavan
    @PR_Pavan Před 9 měsíci +1

    #include
    Int main() {
    Int mark;
    Printf("enter your mark
    ");
    Scanf("%d",&mark);
    Switch(mark){
    Case 10:
    Printf("you mark is 10 ");
    Breake;
    Case 40:
    Printf("your mark is 40");
    Break;
    Case 90:
    Printf("your mark is 90");
    Breake;
    Default:
    Printf(" your mark is not 10 40 or 90");
    }
    Return 0;
    }
    Bro please understand the upper case Letters must be write in Lower case.
    ❤❤

  • @nikitaraut2747
    @nikitaraut2747 Před rokem +14

    Challenge accepted Harry
    I had still seen 10 videos but they are mind blowing .I think no one is there as you Harry You r d best coder I had ever seen

  • @FunTimeWithDew
    @FunTimeWithDew Před 5 lety +3

    Created by Dewanshu..
    #include
    int main()
    {
    int number;
    printf("enter the number from 0 to 5:
    ");
    scanf("%d",&number);
    //enter the number for knew about your personality
    int year;
    printf(" enter the year from 2000-17:
    ");
    scanf("%d",&year);
    //it's just an example
    switch(number)
    {
    case 0:
    printf("Personality:Kind
    ");
    switch(year)
    {
    case 2000:
    printf("the year is : 2000");
    break;
    case 2001:
    printf("the year is : 2001");
    break;
    case 2002:
    printf("the year is : 2002");
    break;
    default:
    printf("The year is not appropriate");
    }
    break;
    case 1:
    printf("Personality:generous
    ");
    switch(year)
    {
    case 2003:
    printf("the year is : 2003");
    break;
    case 2004:
    printf("the year is : 2004");
    break;
    case 2005:
    printf("the year is : 2005");
    break;
    default:
    printf("The year is not appropriate");
    }
    break;
    case 2:
    printf("Personality:Responsible
    ");
    switch(year)
    {
    case 2006:
    printf("the year is : 2006");
    break;
    case 2007:
    printf("the year is : 2007");
    break;
    case 2008:
    printf("the year is : 2008");
    break;
    default:
    printf("The year is not appropriate");
    }
    break;
    case 3:
    printf("Personality:Helpful
    ");
    switch(year)
    {
    case 2009:
    printf("the year is : 2009");
    break;
    case 2010:
    printf("the year is : 2010");
    break;
    case 2011:
    printf("the year is : 2011");
    break;
    default:
    printf("The year is not appropriate");
    }
    break;
    case 4:
    printf("Personality:Clever
    ");
    switch(year)
    {
    case 2012:
    printf("the year is : 2012");
    break;
    case 2013:
    printf("the year is : 2013");
    break;
    case 2014:
    printf("the year is : 2014");
    break;
    default:
    printf("The year is not appropriate");
    }
    break;
    case 5:
    printf("Personality:Smart
    ");
    switch(year)
    {
    case 2015:
    printf("the year is : 2015");
    break;
    case 2016:
    printf("the year is : 2016");
    break;
    case 2017:
    printf("the year is : 2017");
    break;
    default:
    printf("The year is not appropriate");
    }
    break;
    default:
    printf("The number is not appropriate");
    }
    return 0;
    }
    Bro please check it and tell me how can I use character Data type in this format.

  • @ZyramDora8
    @ZyramDora8 Před 2 lety

    Ek calculater bana ne ki kosis kar raha tha sir..apke sare videos bahat ache he aur easy he rehta he..thank you so much.
    #include
    int main()
    {
    int a,b,c;
    float r;
    printf("Enter 2 numbers: ");
    scanf("%d%d",&a,&b);
    printf("
    1) Addition");
    printf("
    2) Substraction");
    printf("
    3) Multiplication");
    printf("
    4) Divison");
    printf("
    5) Modulos");
    printf("
    6) Exit");
    printf("
    Enter your Choice:- ");
    scanf("%d",&c);
    switch(c)
    {
    case 1:
    {
    r=a+b;
    break;
    }
    case 2:
    {
    r=a-b;
    break;
    }
    case 3:
    {
    r=a*b;
    break;
    }
    case 4:
    {
    r=a/b;
    break;
    }
    case 5:
    {
    r=a%b;
    break;
    }
    case 6:
    {
    break;
    }
    default:
    {
    printf("Wrong Entry");
    break;
    }
    }
    printf("Your Answer is %f
    ",r);
    }

  • @Simran-dm3ge
    @Simran-dm3ge Před rokem +13

    {
    int weight;
    printf("Enter your weight
    ");
    scanf("%d", &weight);
    switch (weight)
    {
    case 10:
    printf("You can go for moonwalker ride
    ");
    break;

    default:
    printf("Your weight is not appropriate, you cant go for the ride
    ");
    break;
    }
    }

  • @iamstudying389
    @iamstudying389 Před 8 měsíci +3

    pov: you are learning your first language in your semester break

  • @Sarvesh-he7zx
    @Sarvesh-he7zx Před 18 dny +1

    #include
    int main()
    {
    int value;
    printf("Enter the results of your medical tests
    ");
    scanf("%d", &value);
    switch(value)
    {
    case 80:
    printf("your health is good
    ");
    break;
    case 85:
    printf("your health is more better
    ");
    break;
    case 90:
    printf("your health is excellent
    ");
    break;
    default :
    printf("you have very high chances of sugar");
    }
    return 0;
    }

  • @KRISHNA_CHANDRAWANSHI
    @KRISHNA_CHANDRAWANSHI Před 6 měsíci +1

    #include
    int main()
    {
    int bodycount ;
    printf("enter your body count");
    scanf("%d", & bodycount);
    switch(bodycount){
    case 0:
    printf("you're noob");
    break;
    case 1:
    printf("you're a beginner");
    break;
    case 5:
    printf("you're intermediate");
    break;
    case 10:
    printf("you're expert");
    break;
    default:
    printf("pelo-palo khush rho");
    }
    }

  • @pranitdaphale6409
    @pranitdaphale6409 Před 2 lety +10

    Char a
    Printf("enter your name");
    Scanf ("%d",&a);
    Switch (a)
    {
    Case(sky):
    Printf("your name is sky");
    Break;
    Default
    Printf("your age is not defined");
    }
    Return 0;
    }

  • @manishKumar-tl2ee
    @manishKumar-tl2ee Před 4 lety +6

    if i didn' t used the break command, then default will be executed , that's seems logical. but why other cases are also executed in output.They should not be executed because , how does one entry can satisfy the conditions of all case.??????

    • @abdussamipatel7901
      @abdussamipatel7901 Před 3 lety

      When we don't use break... It doesn't mean it's satisfying remaining cases.... It just executes all statements... As a result, anything inside printf() function display on terminal

  • @manishyadav-lz1hi
    @manishyadav-lz1hi Před rokem +1

    #include
    int main()
    {
    int roll;
    printf("enter your roll
    ");
    scanf("%d", &roll);

    switch (roll)
    {
    case 1:
    printf("congratulations! you pass the entrance exam
    ");
    break;
    case 2:
    printf("you failed all the best for next time
    ");
    break;
    default:
    printf("sorry we can not recognize you
    ");
    }
    return 0;
    }
    i am so late but i understand big brother what you teach us🥰🥰😍

  • @rishabsharma5521
    @rishabsharma5521 Před 3 lety +9

    Hey Harry I'm literally watching your videos and actually it's easy to learn and I can easily implement in programs.

  • @vishalsharma3095
    @vishalsharma3095 Před 4 lety +40

    if,else and switch
    #include
    int main()
    {
    int age, le;
    printf("Enter your age to test drive
    ");
    scanf("%d",&age);
    if (age

    • @jyotiranjankunda1428
      @jyotiranjankunda1428 Před 3 lety

      Bhai ye escape sequence
      ok ka mtlb kya hai jo tumne printf statement ke andar likha h shuruvat me

    • @shreyashkakde9315
      @shreyashkakde9315 Před 3 lety +3

      @@jyotiranjankunda1428 bro vo
      ok nhi hai
      he hai bas inhone
      k bad whitespase nhi deye hai ko kam
      ka he kare ga

    • @idontknow8522
      @idontknow8522 Před 3 lety +1

      @@jyotiranjankunda1428
      ke bad jobhi Likha hota Hain wo new line me Chala jata hain

    • @idontknow8522
      @idontknow8522 Před 3 lety +1

      @@_RajatDhullCSB 🤔

    • @vishalsharma3095
      @vishalsharma3095 Před 3 lety +2

      @@jyotiranjankunda1428/n ka mtlb new line hai
      ok

  • @rautsarthak8401
    @rautsarthak8401 Před rokem +1

    #include
    int main()
    {
    int age;
    printf("what is your age
    ");
    scanf("%d",&age);
    switch(age){
    case 18:
    printf("the ans is sarthak
    ");
    break;
    case 45:
    printf("Its your father age
    ");
    break;
    case 38:
    printf("Its your mothers age
    ");
    break;
    default:
    printf("its is not your describe data
    ");

    }
    return 0;
    }

  • @PriyaGupta-sg4sm
    @PriyaGupta-sg4sm Před rokem +7

    /*a program to demonstrate the usage of switch and case statements
    1) the age should either be 16,25 or 36
    2) the work experience must be 15, 20 or 25 years respectively
    */
    #include
    int main()
    {
    int age, exp ;
    printf("enter your age :
    ");
    scanf("%d",&age);
    printf("enter your experience (in years)
    ");
    scanf("%d",&exp);
    switch (age){
    case 16:
    printf("your age is 16
    ");
    switch (exp){
    case 15:
    printf("YOU ARE ELIGIBLE !");
    break;
    default:
    printf("YOU ARE NOT ELIGIBLE, SORRY !");
    }
    break;
    case 25:
    printf("your age is 25
    ");
    switch (exp){
    case 20:
    printf("YOU ARE ELIGIBLE !");
    break;
    default:
    printf("YOU ARE NOT ELIGIBLE, SORRY !");
    }
    break;
    case 36:
    printf("your age is 36
    ");
    switch (exp){
    case 25:
    printf("YOU ARE ELIGIBLE !");
    break;
    default:
    printf("YOU ARE NOT ELIGIBLE, SORRY !");
    }
    break;
    default:
    printf("not aligible since your age is not 16, 25 or 36");
    }
    return 0;
    }

    • @arunrana-ch2zd
      @arunrana-ch2zd Před rokem

      the only that doesn't fit is that if we enter age 16 code will only sat that you are eligible particularly for exp 15 but not for above (if we are over looking the fact that how can a 16 year old have exp of 15 years lol ) also i have a question cant we use ,= these in switch statements ?
      btw kind efforts 🙂

  • @mkstates6246
    @mkstates6246 Před 3 lety +4

    Sir aap bahut clearly samjhate jo thank you sir 🙏🏻

  • @ashishbalyan835
    @ashishbalyan835 Před 3 lety +5

    Aapky video dekh kr dobra dekhne ky jrurat he nhi pdti 😂 I make a lot of program for my xgf in fun way this is just like game 😂 I I'll injoy your every video 🥰and programming is so funny also 😂😂

    • @los_pollos_hermanos_
      @los_pollos_hermanos_ Před 3 lety +1

      Beta aap galat platform par aa gaye ho. Aap whitehat junior par hi seemit rahe... Aur itna na hi hase toh behtar..

  • @isantsinghrajpoot4670
    @isantsinghrajpoot4670 Před 5 lety +3

    It's really nice explanation of switch
    Thanks

  • @JayKumarKashyap-i4f
    @JayKumarKashyap-i4f Před dnem +1

    #include
    int main()
    { int age, id, true;
    printf("Enter your age : ");
    scanf("%d", &age);
    true = age>=18;
    switch (true)
    {
    case 0:
    printf("You are under age so, you can't vote!
    ");
    break;
    case 1:
    printf("Enter (1) if you have voter id or press some other number
    ");
    scanf("%d", &id);
    switch (id)
    {
    case 1:
    printf("Yes you can vote!
    ");
    break;

    default:
    printf("No you can't vote!
    ");
    break;
    }

    default:
    break;
    }
    return 0;
    }

  • @MuhammadHaris-xp1yd
    @MuhammadHaris-xp1yd Před 3 lety +1

    Great explanation of switch statement❣️
    BHT he easy way ma smjhaya blkol jesa ka vedio ma one way type amjhaata ha ta ka koi doubt na Raha we'll done ar thanks allot 🌸

  • @MdShahid-rb8nc
    @MdShahid-rb8nc Před 2 lety +15

    CHALLENGE ACCEPTED
    #include
    int main()
    {
    int kele,tarbooz;
    printf("kitne kele chiye
    ");
    scanf("%d",&kele);
    printf("tarbooz bhi khayega kya
    ");
    scanf("%d",&tarbooz);
    switch (kele)
    {
    case 6:
    printf("badhiya h khao
    ");
    break;
    case 12:
    printf("kam khaya kar be
    ");
    break;
    case 50:
    printf("janwar hi marega tu
    ");
    switch (tarbooz)
    {
    case 10:
    printf("gandu he kya
    ");
    break;

    default:
    printf("jeele apni zindagi
    ");
    break;
    }
    break;
    default:
    break;
    }
    return 0;
    }

  • @mraduldixit1736
    @mraduldixit1736 Před 8 měsíci +2

    /*
    For check month is Jan,Feb or any other month from the year
    */
    #include
    #include
    int main()
    {
    int mth;
    printf("Enter Month=
    ");
    scanf("%d",&mth);
    switch(mth)
    { case 31:
    printf("entered month is Jan");
    break;
    case 28:
    printf(" Its Feb ");
    break;
    default:
    printf("Any other month in the year
    ");
    }
    getch();
    return 0;
    }

  • @ManishRashtraputMaths
    @ManishRashtraputMaths Před 5 lety +18

    1$t from Manish Aryan

  • @swagatamhazra1910
    @swagatamhazra1910 Před 2 lety +21

    Harry sir You teach better than my college college professor ♥️😀

  • @geethabhute4834
    @geethabhute4834 Před rokem

    #include
    int main(int argc, char const *argv[])
    {
    int num;
    printf("Guess a Number between 1 -10
    ");
    printf("Enter your Number
    ");
    scanf("%d", &num);
    switch (num)
    {
    case 3:
    printf("The Number is 3
    ");
    printf("Congratulations you have guessed a right number!");
    break;
    case 5:
    printf("The Number is 5
    ");
    printf("Congratulations you have guessed a right number!");
    break;
    case 7:
    printf("The Number is 7
    ");
    printf("Congratulations you have guessed a right number!");
    break;
    default:
    printf("No you have entered a wrong number!
    ");
    break;

    }

    return 0;
    }
    Thank U for Teaching in this easy manner.

  • @divyashreechandrana9560
    @divyashreechandrana9560 Před 2 lety +9

    // Write a C program to check whether a number is positive, negative or zero using switch case.
    #include
    int main ()
    {
    int a;
    printf("
    enter a number: ");
    scanf("%d", &a);

    switch (a > 0)
    {
    case 1:
    printf("positive");
    break;
    case 0:
    switch (a

    • @utkarshpankaj5
      @utkarshpankaj5 Před 2 lety +1

      Bhaiya/didi aapne
      pehle lagaya hai vo last me hota hai

    • @ashish4k07
      @ashish4k07 Před 2 lety +1

      @@utkarshpankaj5 its not needed actually instead it could be like this
      printf("Enter a number:");
      scanf("%d",&a);
      this will look good.

    • @deepsahil__
      @deepsahil__ Před 2 lety

      @@utkarshpankaj5 that's upto you, you can use it either in the start or middle or last 🙋‍♂️

    • @Anasboss744
      @Anasboss744 Před rokem

      Cas

  • @it-27utkarshawarbhe28
    @it-27utkarshawarbhe28 Před 2 lety +3

    #include
    int main()
    {
    int num;
    printf("Enter number you want");
    scanf("%d",&num);
    switch(num==num/2)
    {
    case 0:
    printf("It is Even Number");
    break;
    default:
    printf("It is Odd number");
    break;
    }
    return 0;
    }

  • @nizamuddinhameed5249
    @nizamuddinhameed5249 Před rokem

    #include
    int main()
    {
    int shoes;
    printf("Guess the number of pairs of shoes i have");
    scanf("%d", &shoes);
    switch(shoes)
    {
    case 2:
    printf("You've 2 pairs of shoes);
    break;
    case 3:
    printf("You've 3 pairs of shoes);
    break;
    case 4:
    printf("You've 4 pairs of shoes);
    break;
    default:
    printf("You've give the wrong answer")
    }
    }

  • @AdityaPrakashVlogs_14
    @AdityaPrakashVlogs_14 Před rokem +1

    program to check the grade of students by taking input of their marks:=
    #include
    int main(){
    int marks;
    printf("enter your marks= ");
    scanf("%d", &marks);
    switch (marks)
    {
    case 90:
    printf("the Grade is = A
    ");
    break;
    case 80:
    printf("the Grade is = B
    ");
    break;
    case 70:
    printf("the Grade is = C
    ");
    break;
    case 60:
    printf("the Grade is = D
    ");
    break;
    case 50:
    printf("the Grade is = E
    ");
    break;
    case 40:
    printf("FAIL
    ");
    break;
    default:
    printf("the grade Unknown");
    break;
    }
    return 0;
    }

  • @GaneshShinde-ls1iy
    @GaneshShinde-ls1iy Před 4 lety +20

    #include
    int main(int argc, char *argv[])
    {
    int year;
    printf("Enter the year ");
    scanf("%d", &year);
    switch (year)
    {
    case 1983:
    printf("India win 1st world cup");
    break;
    case 2007:
    printf("India win 1st T20 world cup");
    break;
    case 2011:
    printf("India lifts the world cup after 28 years");
    break;
    default:
    printf("Unlucky indian team");
    }
    }

    • @90princesinghbbasem-52
      @90princesinghbbasem-52 Před 4 lety

      Crrct

    • @ritesh1480
      @ritesh1480 Před 4 lety +1

      Not correct bro , jab bhi "int main" use karte hai toh last me ek value return hona chaheye , in this case it should be , return 0; , that's why it will not be executed , rest all is correct , gr8 job

    • @utkarsh25
      @utkarsh25 Před 4 lety +2

      @@ritesh1480 bro par agar ham dev c++ use kar rahe he too hame return value likhne ki jaroorat nahi he kyu ki vo compiler automaticly hi return value dedeta he

    • @omsoni6706
      @omsoni6706 Před 3 lety

      Double Lena tha int q le liya 4 num hai

    • @tarakmehtakaooltachasma8169
      @tarakmehtakaooltachasma8169 Před 3 lety

      @@omsoni6706 right

  • @pankajkumawat9778
    @pankajkumawat9778 Před 2 lety +50

    Thank you sir , you are great.
    include
    int main()
    {
    int choice, a,b,s;
    while(1)
    {
    printf("
    1. Addition");
    printf("
    2. Odd-even");
    printf("
    3. Printing n numbers");
    printf("
    4. Multiplication");
    printf("
    5. exit");

    printf("

    Enter your choice : ");
    scanf("%d", &choice);

    switch(choice)
    {
    case 1:
    printf("

    Enter two numbers : ");
    scanf("%d%d",&a,&b);
    s=a+b;
    printf("Sum is %d", s);
    break;

    case 2:
    printf("

    Enter a number : ");
    scanf("%d", &a);
    if(a%2==0)
    printf("
    even number");
    else
    printf("
    odd number");

    break;

    case 3:
    printf("

    Enter a number : ");
    scanf("%d", &a);

    for(b=1;b

  • @attaurrahaman6843
    @attaurrahaman6843 Před 3 lety +13

    I've written a menu driven program with exit , with the help of while loop .
    Thank you sir , you are great.
    include
    int main()
    {
    int choice, a,b,s;
    while(1)
    {
    printf("
    1. Addition");
    printf("
    2. Odd-even");
    printf("
    3. Printing n numbers");
    printf("
    4. Multiplication");
    printf("
    5. exit");
    printf("

    Enter your choice : ");
    scanf("%d", &choice);
    switch(choice)
    {
    case 1:
    printf("

    Enter two numbers : ");
    scanf("%d%d",&a,&b);
    s=a+b;
    printf("Sum is %d", s);
    break;
    case 2:
    printf("

    Enter a number : ");
    scanf("%d", &a);
    if(a%2==0)
    printf("
    even number");
    else
    printf("
    odd number");
    break;
    case 3:
    printf("

    Enter a number : ");
    scanf("%d", &a);
    for(b=1;b

  • @jyoti-sm5co
    @jyoti-sm5co Před 5 měsíci

    #Include
    Int main()
    {
    Int x;
    printf("enter a number");
    scanf("%d",&x);
    Switch(x)
    Case 1:printf("Monday");
    break;
    case 2:printf("Tuesday");
    break;
    case 3:printf("Thursday");
    break;
    case 4:printf("Friday");
    break;
    case 5:printf("Saturday");
    break;
    case 6:printf("Wednesday");
    break;
    case 7:printf("Sunday");
    break;
    default : printf("not a valid day");

  • @215avinashjhaevening2
    @215avinashjhaevening2 Před 2 lety +1

    This video is helping me in 2022

  • @debodhkumar2905
    @debodhkumar2905 Před 4 lety +73

    #include
    #include
    int main(int argc, char const *argv[])
    {
    int x,p;
    printf("Enter the value of X
    ");
    scanf("%d", &x);
    printf("And enter your age please
    ");
    scanf("%d", &p);
    switch (x)
    {
    case 0:
    printf("Yes! 0 is the correct answer
    ");
    printf("there are two answers of this question, please find the other answer too
    ");
    switch (p)
    {
    case 23:
    printf("your IQ is brilliant according to your current age
    ");
    break;

    default:
    printf("Your IQ does not match according to your age
    ");
    break;
    }
    break;
    case 1:
    printf("Yes! 1 is the correct answer
    ");
    printf("there are two answers of this question, please find the other answer too
    ");
    switch (p)
    {
    case 23:
    printf("your IQ is brilliant according to your current age
    ");
    break;

    default:
    printf("Your IQ does not match according to your age
    ");
    break;
    }
    break;

    default:
    printf("your answer is incorrect
    ");
    printf("sorry your IQ does not match with your age
    ");
    break;
    }
    return 0;
    }

    • @padhle2184
      @padhle2184 Před 3 lety +2

      tumne c++ ka code likha hai ya c ka?

    • @debodhkumar2905
      @debodhkumar2905 Před 3 lety +2

      @@padhle2184 C language ka

    • @adil470
      @adil470 Před 3 lety +2

      @@padhle2184 bhai main func ku dekh ke confuse mathhojao c he c++ nahi

    • @jasopakisan1771
      @jasopakisan1771 Před 3 lety

      @@padhle2184 nahi

  • @rasikashahapure6777
    @rasikashahapure6777 Před 6 měsíci +1

    #include
    int main()
    {
    int day;
    printf("Enter your day
    ");
    scanf("%d", &day);
    switch (day)
    {
    case 1:
    printf("The day is Monday");
    break;
    case 2:
    printf("The day is Tuesday");
    break;
    case 3:
    printf("The day is Wednesday");
    break;

    case 4:
    printf("The day is Thursday");
    break;

    case 5:
    printf("The day is Friday");
    break;

    case 6:
    printf("The day is Saturday");
    break;

    case 7:
    printf("The day is Sunday");
    break;
    default:
    printf("Not a day");
    break;
    }

    return 0;
    }

  • @mrnavdip9560
    @mrnavdip9560 Před 2 lety +19

    Thanks you sir, my dream is one day I'll in cyber security and I never forget in my life🔥❤️
    Your every lecture are very useful for all student and you are god for me.

    • @geteverything8252
      @geteverything8252 Před 2 lety +2

      Mere liye bhi yaar harry bhai kya padate hai yaar vo mere liye bhagwan hai jindagi mai ek bar jarur milunga 🙏

    • @Hyd35
      @Hyd35 Před 2 lety +3

      Bro to get into cyber security what else i have to know i mean which language i has to study. And what else?

    • @mrnavdip9560
      @mrnavdip9560 Před 2 lety +3

      @@Hyd35 c++ , py. ect..

    • @Hyd35
      @Hyd35 Před 2 lety +1

      @@mrnavdip9560 thankyou😇

  • @girishdhakar401
    @girishdhakar401 Před rokem +1

    #include
    int main(){
    int runs;
    printf("how many runs scored:");
    scanf("%d",&runs);
    switch(runs){
    case 50:
    printf("virat played a fabulous inning of 50 runs
    ");
    break;
    case 100:
    printf("virat played a fabulous inning of 100 runs
    ");
    break;

    default:
    printf("virat neither scored 50 nor 100 runs
    ");
    }
    return 0;
    }

  • @VanshPruthi-mk4pq
    @VanshPruthi-mk4pq Před 2 měsíci +1

    #include
    int main() {
    int day;
    printf("Enter the value for day in no. :
    ");
    scanf("%d",&day);
    switch(day){
    case 1:
    printf("The day is monday");
    break;
    case 2:
    printf("The day is tuesday");
    break;
    case 3:
    printf("The day is wednesday");
    break;
    case 4:
    printf("The day is thursday");
    break;
    case 5:
    printf("The day is friday");
    break;
    case 6:
    printf("The day is saturday");
    break;
    case 7:
    printf("The day is sunday");
    break;
    default:
    printf("Invalid day");
    break;
    }
    return 0;
    }

  • @mayankpanjwani6643
    @mayankpanjwani6643 Před 4 lety +13

    I NEED A CHEAT SHEET OF
    C PROGRAMMING LANGUAGES.

  • @adityatripathi2178
    @adityatripathi2178 Před 3 lety +7

    // code to determine your permits according to your age//
    # include
    int main() {
    int age;
    printf("Enter your age
    ");
    scanf("%d", &age);
    switch (age)
    {
    case 20
    :
    printf("You can make your own decions
    ");
    // break;
    case 18 :
    printf("You can drive a vehicle
    ");
    // break;
    case 15:
    printf("You can go out with friends
    ");
    // break;
    case 10:
    printf("You can watch a movie
    ");
    // break;
    case 5:
    printf("You can interact with people
    ");
    break;

    default:
    printf("Are you even born ");
    break;
    }
    return 0;
    }

  • @virajdhakane440
    @virajdhakane440 Před rokem +1

    #include
    int main()
    Char ch;
    frintf("enter charactor);
    Scanf("%c",&ch);
    Switch(ch)
    {
    case 'a' : printf("vowel");
    break;
    default:printf("uconsoment");
    }
    return 0;
    }

  • @hestroif
    @hestroif Před 2 lety +1

    #include
    int main(int argc, char const *argv[])
    {
    int subject;
    printf("type 1 for Math. 2 for Physics. 3 for Chemistry. 0 for all Math, Physics and Chemistry
    ");
    printf("Enter the subject name : ");
    scanf("%d", &subject);
    switch (subject)
    {
    case 0:
    printf("You've selected all subjects.");

    break;

    case 1:
    printf("You've selected Math.");
    break;
    case 2:
    printf("You've selected Physics.");
    break;
    case 3:
    printf("You've selected Chemistry.");
    break;
    default:
    printf("You didn't entered wrong number.");
    break;
    }
    return 0;
    }

  • @groww9276
    @groww9276 Před 5 lety +4

    Please promise that after C language you make videos on java or android.please.

  • @pralaydas9785
    @pralaydas9785 Před 5 lety +9

    #include
    #include
    void main()
    {
    int height;
    clrscr();
    printf("Enter your Height..(4,5,6)
    ");
    scanf("%d
    ",&height);
    switch (height){
    case 4:
    printf("Your height is 4 feet
    ");
    break;
    case 5:
    printf("Your height is 5 feet");
    break;
    case 6:
    printf("Your height is 6 feet");
    break;
    default:
    printf("Sorry you enterd wrong digits..");
    }
    getch();
    }

    • @AbhishekKumar-hz9jo
      @AbhishekKumar-hz9jo Před 3 lety +3

      It seems like you coded in turbo C compiler☺☺☺

    • @1plusspace568
      @1plusspace568 Před 2 lety +1

      Y u wrote that in scanf (/n)
      It mean u will go for next line
      U can write it after &height .

  • @Hariom-ix5wr
    @Hariom-ix5wr Před 2 lety +1

    #include
    int main()
    {
    Char ch;
    printf("enter any ch");
    scanf("%c",&ch);
    switch (ch);
    {
    Case'a';
    printf("vowel");
    break;
    case'e';
    printf("vowel");
    break;
    case'i';
    printf("vowel");
    break;
    Case'o';
    printf("vowel");
    break;
    Case'u';
    printf("vowel";
    break;
    dafacult;
    printf ("consonant");
    return 0;
    }

  • @rohanmasne1209
    @rohanmasne1209 Před 3 lety +3

    playlist
    1. beliver 2.despacito 3.seniorita 4.peaches
    main()
    {
    int n ;
    printf("
    enter the song number that you like ");
    scanf("%d",n);
    switch(n)
    {
    case 1 :
    printf("
    beliver");
    break;
    case 2 :
    printf("
    despacito");
    break;
    case 3 :
    printf("
    seniorita ");
    break;
    case 4:
    printf("
    peaches");
    break;
    default :
    printf("
    sorry , 4 songs available ");
    break;
    }

  • @kanavbatra443
    @kanavbatra443 Před 2 lety +3

    // a code for school purposes
    #include
    int main(int argc, char const *argv[])
    {
    int a, b;
    printf("Enter your class[6,7,8]
    -->");
    scanf("%d", &a);
    printf("Enter your marks [MM-80]
    -->");
    scanf("%d", &b);
    switch (a)
    {
    case 6:
    printf("ok......
    ");
    if (b > 32 && b < 80)
    {
    printf("Passed!!
    ");
    }
    else if (b < 32)
    {
    printf("Failed!!
    ");
    }
    else
    {
    printf("Wrong input!!!
    ");
    }
    break;
    case 7:
    printf("ok......
    ");
    if (b > 40 && b < 80)
    {
    printf("Passed!!
    ");
    }
    else if (b < 40)
    {
    printf("Failed!!
    ");
    }
    else
    {
    printf("Wrong input!!!
    ");
    }
    break;
    case 8:
    printf("ok......
    ");
    if (b > 42 && b < 80)
    {
    printf("Passed!!
    ");
    }
    else if (b < 42 && b < 80)
    {
    printf("Failed!!
    ");
    }
    else
    {
    printf("Wrong input!!!
    ");
    }
    break;
    default:
    printf("You have entered wrong class!!
    ");
    break;
    }
    return 0;
    }
    // i know its long enough but can be helpful

  • @rupeshvlogs2464
    @rupeshvlogs2464 Před 2 měsíci

    #include
    int main() {
    int age;
    printf ("enter your age
    ");
    scanf("%d",&age);
    switch (age){
    case 2:
    printf ("this is age 20
    ");
    break ;
    case 3:
    printf ("this is age 45
    ");
    break;
    default:
    printf ("age is not 20 and 45
    ");
    }
    return 0;
    }

  • @sohamrajput783
    @sohamrajput783 Před 2 lety +5

    #include
    #include
    void main()
    {
    clrscr();
    int choice;
    printf("fields available
    1.BCCA
    2.BCOM
    3.BSC
    -------------------------------------------
    ");
    printf("enter the field you want to get graduated with:");
    scanf("%d", &choice);
    switch (choice)
    {
    case 1:
    printf("your choice is BCCA");
    break;
    case 2:
    printf("your choice is BCOM");
    break;
    case 3:
    printf("your choice is BSC");
    break;
    default:
    printf("invalid field name, enter the number of field i.e. 1,2 or 3");
    }
    getch();
    }

  • @_tufaaaan_
    @_tufaaaan_ Před 5 dny

    Include
    Int (main)
    [
    Int name;
    Printf("enter the name"/n);
    Scanf("%d/n" , &name);
    Switch
    Case tanu;
    Printf("your name is tanu/n");
    Break;
    Default
    Printf("your name is tanu");
    Default (

  • @pankajhazarika1148
    @pankajhazarika1148 Před 3 lety +3

    void main()
    {
    int const X=0;
    switch(5/4/3){
    case X: printf("Clinton");
    break;
    case X+1:printf("Gandhi");
    break;
    case X+2:printf("Gates");
    break;
    default: printf("Brown");
    }
    }
    Select one:
    a.
    Clinton
    b.
    Gandhi
    c.
    Gates
    d.
    compiler Error
    Answer do

  • @AdityaKate_
    @AdityaKate_ Před 4 měsíci

    Simple Calculator Code using Switch case:
    #include
    int main()
    {
    int Number;
    printf("Enter the mode you want to select
    ");
    printf(" 1.Addition
    2.Subtraction
    3.Multiplication
    4.Division
    ");
    scanf("%d", &Number);
    switch(Number)
    {
    case 1:
    printf("we will be doing addition");
    break;
    case 2:
    printf("we will be doing subtraction");
    break;
    case 3:
    printf("we will be doing multiplication");
    break;
    case 4:
    printf("we will be doing division");
    break;
    default:
    printf("Error, re-enter the number");
    }
    return 0;
    }

  • @user-yv5gz3ws6f
    @user-yv5gz3ws6f Před 4 měsíci

    #include
    int main(){
    int recipe;
    printf ("enter a number 1-3");
    scanf("%d",&recipe);
    switch (recipe){
    case 1:
    printf ("I want biryani
    ");
    case 2:
    printf (" i want rice
    ");
    case 3:
    printf ("I want soup
    ");
    default:
    printf ("I want only water
    ");
    }
    return 0;
    }

  • @muhammadsameer9161
    @muhammadsameer9161 Před 4 lety +8

    #include
    #include
    int main() //funciton
    {
    int x;
    printf("you can only know three boys weight on the following
    Press 1 for sameer
    Press 2 for asad
    Press 3 for khan
    ");
    scanf("%d", &x);

    switch(x){
    case 1:
    printf("The weight of Sameer is: 60kg
    ");
    break;
    case 2:
    printf("The weight of Asad is: 58kg
    ");
    break;
    case 3:
    printf("The weight of Khan is: 55kg
    ");
    break;
    default:
    printf("Invalid Number");
    }
    return 0;
    }
    love from Pakistan

  • @jayanspaliwal5907
    @jayanspaliwal5907 Před 3 lety +8

    I think it's better to use break if we don't want the code to behave erratic

  • @mr.smarty1661
    @mr.smarty1661 Před 5 měsíci

    #include
    int main() {
    int class ;
    printf("Enter your class: ");
    sacnf("%d",&class);
    switch(class){
    case2:
    printf("Class is 2");
    case3:
    printf("Class is 3");
    case7:
    printf("Class is 7");
    default :
    printf("You haven't choose any class");
    }
    }

  • @tanmaydaga7204
    @tanmaydaga7204 Před 4 lety +3

    //Hope you like the code SIr
    int age;
    printf("Please enter your age");
    scanf("%d", &age);
    switch (age)
    {
    case 5:
    printf("You are too small for driving");
    case 10:
    printf("You are too small for driving");
    break;
    case 14:
    printf("You are not too small for driving");
    case 17:
    printf("You are just about to pass age for driving");
    break;
    case 18:
    printf("You can drive");
    default:
    printf("Cannot find your age");
    break;
    }

  • @NaachMore
    @NaachMore Před 9 měsíci

    #include
    int main() {
    int a;
    printf("Enter a=");
    scanf("%d",&a);

    switch(a) {
    case 1:
    printf("value is 10");
    break;
    case 2:
    printf("value is 20");
    break;
    default:
    printf("not found");
    break;
    }
    return 0;
    }

    • @NaachMore
      @NaachMore Před 9 měsíci

      #include
      int main()
      {
      int days;
      printf ("enter the number of days=");
      scanf ("%d",&days);

      switch(days) {
      case 30:
      printf("
      it can be april, june, aug");
      break;

      case 31:
      printf("
      it can be jan, mar, july");
      break;

      case 29:
      printf("
      it can be feb");
      break;

      default:
      printf("
      it is something");
      }
      return 0;
      }

  • @food8814
    @food8814 Před 3 lety +4

    int main()
    {
    int class;
    printf("enter your class")
    scanf("%d",&class);
    switch(class)
    {
    class 5:
    printf("the class is 5th std");
    break;
    class 6:
    printf("the class is 6th std");
    break;
    default:
    printf("your class is not 3th std and 5th std");
    }
    return 0;
    }

    • @mahmad48
      @mahmad48 Před 3 lety +1

      statement terminator after printf statement and in last not 3th it should be 6th

  • @srij_12
    @srij_12 Před 3 lety +3

    # include
    // conversion of marks to grades .
    int main()
    {
    int marks;
    printf("enter your marks between 0 to 100
    ");
    scanf("%d" , &marks);
    switch(marks/10)
    {
    case 10 :
    case 9 :
    printf("your grade is A
    ");
    break;
    case 8 :
    printf("your grade is B
    ");
    break;
    case 7 :
    printf("your grade is C
    ");
    break;
    case 6 :
    printf("your grade is D
    ");
    break;
    default :
    printf("your grade is F");
    break;
    }
    return 0;
    }

  • @jairamchandani5329
    @jairamchandani5329 Před 4 lety +3

    main()
    {
    int marks;
    printf("enter you marks");
    scanf("%d", &marks);
    switch (marks)
    {
    case 1:
    printf("your marks are 450");
    default :
    printf("your marks are not valid");}
    }

  • @madhamitadas
    @madhamitadas Před 5 dny

    #include
    int main()
    {
    int day;
    printf("Enter the number of days you went to office: ");
    scanf("%d", &day);
    switch(day){
    case 5:
    printf("Great, you went to office for 5 days");
    case 4:
    printf("Good but try to go to office for 5 days");
    break;
    break;
    case 3:
    printf("Not good, you didnt go to office for 5 days");
    case 2:
    printf("Very bad, your salary will be deducted.");
    break;
    default:
    printf("You should work from office or meet the HR");

    }
    return 0;
    }

  • @manshulduggal5482
    @manshulduggal5482 Před 5 lety +4

    #include
    int main(){
    int a;
    printf("enter your age
    ");
    scanf("%d",&a);
    switch(a){
    case 18:
    printf("you can oficially watch porn");
    break;
    case 2:
    printf("how the hell can you use this thing, are you an alien?");
    break;
    case 70:
    printf("wow, An old man in the house");
    break;
    default:
    printf("enter the goddamn age");
    }
    return 0;
    }

  • @officialamansaini4818
    @officialamansaini4818 Před 7 měsíci

    #include
    int main ()
    {
    int time;
    printf("Enter the time
    ");
    scanf("%d", &time);
    switch (time)
    {
    case 2:
    printf("School ki chutti hogi
    ");
    break;
    case 4:
    printf("Tution jana hai
    ");
    break ;
    case 7:
    printf("Khana khaunga
    ");
    break ;
    default:
    printf("kuch nhi krunga
    ");
    }
    return 0;
    }

  • @sharyyyyy4
    @sharyyyyy4 Před 8 měsíci

    #include
    int main() {
    int height;
    printf("enter your height: ");
    scanf("%d", &height);
    switch(height){
    case 5:
    printf("your height is 5");
    break;
    case 6:
    printf("your height is 6");
    break;
    case 7:
    printf("your height is 7");
    break;
    default:
    printf("error");
    }
    return 0; }

  • @teertharajturkar
    @teertharajturkar Před rokem +1

    #include
    Int main()
    {
    Int a;
    printf("enter 1 number
    ");
    scanf("%d",&a);
    switch(a)
    {
    case 1:
    printf("Teertharaj turkar
    ");
    break;
    default:
    printf("you have not enter 1 number");
    }
    return 0;
    }

  • @Sarvesh-he7zx
    @Sarvesh-he7zx Před 18 dny +1

    #include
    // some medical tests were done and accourding to the results the condition of heart was determined
    int main()
    {
    int value;
    printf("Enter the results of your medical tests
    ");
    scanf("%d", &value);
    switch(value)
    {
    case 80:
    printf("your health is good
    ");
    break;
    case 85:
    printf("your health is more better
    ");
    break;
    case 90:
    printf("your health is excellent
    ");
    break;
    default :
    printf("you have very high chances of sugar");
    }
    return 0;
    }

  • @puneetsinghmashiana1299
    @puneetsinghmashiana1299 Před 3 lety +2

    @CodeWithHarry sir 14:51 pr aapne kissi bhe case mai break nhi lgaya ....or aapne age 3 rakhi ...tb case true hoga tabhi print hoga ...pehla output the age is 3 sahi h lakin uske baad doosre kyu print hore h ki age 13 h ,23 h default ka toh smjh aata h lakin ye case kyu print hore h value toh match nhi ho ri ?plssss sir ans kr do

  • @janhvinarayan1633
    @janhvinarayan1633 Před 8 měsíci +1

    love your way of explaining, i wish all my college teachers were like u but never mind.

  • @stunningdance-qo3ce
    @stunningdance-qo3ce Před 12 dny

    Sir you are amazing ❤❤❤ teaching style is incredible