C++ Modulus, Short-Hand Operators | CPP Video Tutorial

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

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

  • @Dododidsomethingwrong
    @Dododidsomethingwrong 7 лет назад +1

    Cleared my doubts for modulus operator , thanks

  • @哦-p5o
    @哦-p5o 2 года назад

    so thankful for you tutorial, finally understand what is modulus

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

    Thanks sir, clear and reachable

  • @shankersalil7662
    @shankersalil7662 4 года назад +1

    4 % 3 = 1
    4 % -3 = 1
    -4 % 3 = -1
    -4 % -3 = -1
    cause % calculate remainder and gives sign of numerator

  • @LevelUP_04
    @LevelUP_04 4 года назад +1

    thanks bro u saved my life
    tmrw test

    • @LearningLad
      @LearningLad  4 года назад

      my pleasure :)

    • @xyzabc4399
      @xyzabc4399 4 года назад

      @@LearningLad u told vdo would be in Hindi where it is?

  • @akashdubey7083
    @akashdubey7083 4 года назад +1

    Sir your teaching style is superb plz sir put some theory and then cover practical thank you

    • @LearningLad
      @LearningLad  4 года назад +1

      thank you for the suggestion.
      i'll try to do it :)

  • @aqibasmat9502
    @aqibasmat9502 7 лет назад

    ufff this c++ has so many ways of declaring varaibale and etc

  • @harshitgupta5053
    @harshitgupta5053 6 лет назад +1

    Superb explanation

  • @changheonchung
    @changheonchung 9 лет назад +1

    Hi just to be curious is this even helpful in programming I haven't seen all the RUclips Tutorials but I just want to know before going further...
    Isn't this more like helping us with the Mathematics, sorry I'm new to programming and other stuff much help appreciated.

  • @Mingau..
    @Mingau.. 2 года назад +1

    thank you

  • @Ezee.Money.U
    @Ezee.Money.U 6 лет назад

    so complex !! but simple.

  • @najehmchirgui7968
    @najehmchirgui7968 8 лет назад +1

    thanks you so much

  • @saiprakashvajragiri58
    @saiprakashvajragiri58 5 лет назад +1

    Which compiler r u using

  • @islamicworld1582
    @islamicworld1582 7 лет назад

    What can i do to keep the work in mind i,m forgetting the done work if going further

  • @74sumityadav91
    @74sumityadav91 7 лет назад +1

    sir u should add some more tutorial videos on using graphic function in c++ .

  • @Bhuyan_G
    @Bhuyan_G 6 лет назад

    do we always need to initialize the values of the variables in order to carry out an arithmetic operation ? this is kind of absurd , because what happens when we want to carry out sum or any other arithmetic operation later on with variables other than those we initialized for the specified variables ??

  • @mriduljuyal4593
    @mriduljuyal4593 7 лет назад

    int a=3;
    cout

  • @raghavendrasingh257
    @raghavendrasingh257 7 лет назад +1

    Sir why am I getting output as 2 for program below?
    #include
    using namespace std;
    int main()
    {
    int a=25;
    int b=10;
    float c;
    c=a/b;
    cout

    • @LearningLad
      @LearningLad  7 лет назад

      both a and b are of integer type.
      so the.5 is ignored.
      make them float. it will work :)

    • @raghavendrasingh257
      @raghavendrasingh257 7 лет назад +1

      thanks sir

  • @mullangikeerthankumarreddy4548
    @mullangikeerthankumarreddy4548 7 лет назад

    hello,
    how can we use this short_hand operators for 3variables and more??

  • @kaushalpatidar7383
    @kaushalpatidar7383 6 лет назад

    Sir...the execution is not happening with "-" and "/".....in my program it gives the value of num1.
    Please help me out.

  • @niels8718
    @niels8718 9 лет назад

    where did you get that 18 from? (2.35). I tried alot but i coudn't find it :/

    • @mandelandreinitu3461
      @mandelandreinitu3461 8 лет назад +1

      +Niels Langeweg 3*6=18 , the biggest multiple of 3 smaller than 20

  • @shovonsaha3924
    @shovonsaha3924 4 года назад +1

    int num1=10,num2=3;
    num1+=num2; num1%=num2;
    cout

    • @LearningLad
      @LearningLad  4 года назад

      no answer shows 1.
      check your program.

  • @harshsoni528
    @harshsoni528 7 лет назад

    Sir, This is harsh and when i was using float variables to obtain the remainder of the value it showed a error : invalid operands of types 'float' and 'float' to binary operator%'

    • @TheWarren5000
      @TheWarren5000 7 лет назад +1

      You cannot use the modulus operator on float variables

  • @shettipellikomal6421
    @shettipellikomal6421 5 лет назад

    int a=20, b=3;
    cout

  • @aloke8921
    @aloke8921 7 лет назад +1

    Any thing on python in this Chanel?!

  • @Shubham-xh9nz
    @Shubham-xh9nz 7 лет назад

    = work right to left ( i know some basic) i think in no any previous video we talked about that :/

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

    cout

  • @rehanalampanah
    @rehanalampanah 6 лет назад

    when i take num 1=10,num 2=20;
    then compiler gives answer 10.
    y is it so? even i took float but it gave the same answer.
    plzz reply..

    • @aditya7778
      @aditya7778 5 лет назад

      These is just because modulus will
      Give remainder. You give the input
      To compiler as 10%20 hence(10/20=10(rem)and 0(q)) thus it will give 10.

    • @s.bagavathsingh419
      @s.bagavathsingh419 4 года назад

      This is used by the following formula. (Quotient*Divisor)+Remainder=Dividend
      Here we can't divide 10 by 20. So put quotient value 0. Now you multiply this value with divisor value 20. Now you get 0*20=0. Now you subtract this value from Dividend value 10. 10-0=10. So remainder value is 10. Now apply the formula for checking.
      (0*20)+10=0+10=10

  • @StardustGalaxy007
    @StardustGalaxy007 6 лет назад

    #include
    using namespace std;
    int main()
    {
    int nub1 = 10, nub2 = 20;
    cout

    • @rachadelmoutaouaffiq5019
      @rachadelmoutaouaffiq5019 6 лет назад +1

      10 /20 = 0 *10+ 10 so modulo = 10
      20 /10 = 2*10+0 so modulo = 0
      modulo = rest of division
      10/20 is 0.5 but int 0.5 = 0
      and rest is 10
      **sorry for my english ^^*

    • @s.bagavathsingh419
      @s.bagavathsingh419 4 года назад

      This is used by the following formula. (Quotient*Divisor)+Remainder=Dividend
      Here we can't divide 10 by 20. So put quotient value 0. Now you multiply this value with divisor value 20. Now you get 0*20=0. Now you subtract this value from Dividend value 10. 10-0=10. So remainder value is 10. Now apply the formula for checking.
      (0*20)+10=0+10=10

  • @chakribalaga3934
    @chakribalaga3934 9 лет назад

    why can't i apply modulus operation to float?

    • @mandelandreinitu3461
      @mandelandreinitu3461 8 лет назад

      +Chakri Balaga modulus operation is just for integers.But , if you want to use something similar you need to use fmod(num1,num2) in the program and to put #include at the beginning.Here is a example:#include #include using namespace std;int main(){double num1,num2;cin>>num1>>num2;cout

  • @CindyK9
    @CindyK9 10 лет назад

    The Short-Hand operator is too short. I want to know what it actually does, and WHY programmers would use it? If you tell WHY we use certain operators and functions, it makes it better to understand and remember it.

    • @SangaPommike
      @SangaPommike 9 лет назад +1

      Cindy Yap Writing num1+=num2; is just shorter than writing num1=num1+num2; You don't need to repeatedly write the same thing. I'm fairly certain there's no difference for the machine, though.

  • @shankersalil7662
    @shankersalil7662 4 года назад

    💞💞💞💞💞

  • @mohammadyounus5456
    @mohammadyounus5456 7 лет назад +2

    Sir can u make C++ tutorials in hindi?

    • @LearningLad
      @LearningLad  7 лет назад +2

      sure. i have plans :)

    • @iftakharalam1650
      @iftakharalam1650 6 лет назад

      Learn English, it will help you allt in future.. in india, english i think is becoming first language

  • @mominuber
    @mominuber 9 лет назад +2

    bro tell ME how to use MULTI OPERATOR SELECTION IN programe
    #include
    using namespace std;
    int main()
    {
    int num1,num2;
    cout >num1;
    cout >num2;
    num1 +=num2;
    cout

    • @ryancomputerscience3587
      @ryancomputerscience3587 6 лет назад

      #include
      using namespace std;
      int main()
      {
      cout > num1;
      cout > num2;
      num1 += num2;
      cout

  • @shalinireddy4744
    @shalinireddy4744 5 лет назад

    Hi Anil, Thanks for your videos.
    could you please let me know how to write all the shorthand operators( +=, -=, *=, /=, %=) in a single program.
    thanks.

    • @II_xD_II
      @II_xD_II 4 года назад

      what how?
      that depends upon u try that on an example number and then write a program in a generalised form

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

    v

  • @akira-ky3yy
    @akira-ky3yy 8 лет назад +1

    oh i see so the short hand just basically makes it so you dont have to write like so much stuff