Python Program to find Sum of Digits of a Given Number - In Hindi

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

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

  • @ankitsaxena565
    @ankitsaxena565 5 лет назад +18

    Nice sir ji,your concept is very easily, thanks sir

  • @Prac847
    @Prac847 3 года назад +8

    Thank you so much sir ! I like your teaching very much ,God bless you sir , I hope your journey will be very successful 💯😇

    • @codeitup
      @codeitup  3 года назад

      Most welcome Prachi.. & thank you so much for your precious comment😊

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

    Explained in a very easy manner, thanks sir

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

    im in engineering first year and this video helped me a lot. thanks so much.

  • @roshnisingh4372
    @roshnisingh4372 3 года назад +7

    Hello sir I am from engineering field but your way of teaching is soo easy and simple and understood . Sir would u plz make video for django.

  • @yogeshrathore4697
    @yogeshrathore4697 3 года назад +1

    Sir really excellent explanation.....ek ek step crystal clear ho gya h

    • @codeitup
      @codeitup  3 года назад

      Thanks a lot Yogesh 😊

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

    You're very best teacher ❤️

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

    Amazing way to make understand...
    Thank U so much sir..

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

      Thanks & most welcome Pratap!

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

    U HELPED ME DO MY CHOOL ASSIGNMENT THAT'S WHAT I CARE U ARE GOD 🙏

  • @nehadhiran8572
    @nehadhiran8572 4 года назад +3

    Ur way of teaching is so good sir ❤️❤️❤️

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

      Thanks a million Neha!

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

    Thank you so much sir ☺️. Aapne sare confusion hi clear kr diya

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

      Most welcome😊

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

    For beginners this video is really helpful

  • @sakshinaik05
    @sakshinaik05 4 года назад +4

    Very easy to understand thanks for this video

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

      Glad it helped🙂

  • @shubhamx5795
    @shubhamx5795 3 года назад

    Crystal Clear ❤️❤️

  • @AnujSharma-qr9mh
    @AnujSharma-qr9mh 2 года назад +1

    Thanks for explaining the logic.

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

      Most welcome Anuj!

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

    very nice video sir 🥰🥰🥰

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

    🙏🙏🙏🤩🤩🤩thanks a lot sir

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

      Most welcome Kiran!

  • @debarghyaadhikari5558
    @debarghyaadhikari5558 3 года назад +1

    Nice Explanation

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

    I thik such type of teaching is not available in any channel 😅.... thanks you so much sir 😊

    • @codeitup
      @codeitup  3 года назад

      Thanks & most welcome😊

  • @poonamdua5196
    @poonamdua5196 3 года назад

    Thank you sir. I have cleared all of my doubts.

    • @codeitup
      @codeitup  3 года назад

      That's good Poonam, keep learning!

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

    Sir your all video are very helpful... Thank you so much😊

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

      Glad to help you😊

  • @tushar674
    @tushar674 5 лет назад +3

    Great sir.. your videos are very informative.

    • @codeitup
      @codeitup  5 лет назад +2

      Thanks tushar. Keep uploading.

    • @PRADEEPCHOUDHARY.
      @PRADEEPCHOUDHARY. 4 года назад

      @@codeitup ye Program Recursion se kaise banega .....isko BTA de plzzzz using recursion (sum of digits)

    • @yashrawat747
      @yashrawat747 3 года назад

      sir how can i tackle such type of questions in future it looks like we have to learn it
      ?

  • @MrMukulpandey
    @MrMukulpandey 3 года назад

    Easy explanation 👍

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

    Helpful...👍

  • @RishabhJain-pq6ki
    @RishabhJain-pq6ki 3 года назад

    I am thinking how well could a teacher teach on youtube? Best cs teacher pn youtube

  • @rdxvikrant8608
    @rdxvikrant8608 5 лет назад +2

    superb sir keep it up

  • @RameshPal-cd4cs
    @RameshPal-cd4cs 6 месяцев назад

    Nicely explained.

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

      Glad you liked it!

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

    Awesome

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

    Nice video hai❤

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

    awesome video sir

  • @RoshanSingh-kj4fy
    @RoshanSingh-kj4fy 7 месяцев назад

    Great sir

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

    Thanku sir, really good explanation

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

      You're most welcome !

  • @minakshi_119
    @minakshi_119 3 года назад

    Thank you so much sir🙏

    • @codeitup
      @codeitup  3 года назад

      Most welcome dear!

  • @abhinavmurali7301
    @abhinavmurali7301 3 года назад

    Thanks sir ❤️❤️

    • @codeitup
      @codeitup  3 года назад

      Most welcome Abhinav!

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

    Nice 👍

  • @Dileepkumar-cp2qp
    @Dileepkumar-cp2qp 4 года назад +1

    Thank you so much sir

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

      Most welcome Dileep !

    • @Dileepkumar-cp2qp
      @Dileepkumar-cp2qp 4 года назад

      @@codeitup sir strong or not eska concept nhi samjh aa raha hai sir please aap strong or not ka bhi program samjha dijiye

  • @debatradas1597
    @debatradas1597 3 года назад

    Thank you so much

    • @codeitup
      @codeitup  3 года назад +1

      Most welcome😊

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

    Damn explanation!!

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

    THANK YOU SIR...

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

    So nice sir thanks sir

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

      Welcome Anju !!!

  • @yuwanisawanika1620
    @yuwanisawanika1620 3 года назад

    Thank you soo much

    • @codeitup
      @codeitup  3 года назад

      Most welcome Yuwani!

  • @harshvardhanpatil5248
    @harshvardhanpatil5248 3 года назад

    Zhakkas sir
    Bahut acchey sey cover kiya aapney
    Sir one request please
    Ki agar mein aap key python ki puuri playlist follow karunga toh kya mujhe concepts key saath unpar puurey practice problems bhi milengey???
    Please tell sir
    Mujhey aapney doston ko bhi ye course recommend karna hai

    • @codeitup
      @codeitup  3 года назад

      Follow "Complete Python Tutorial" playlist, which will cover every topic step by step and will help you to learn python completely.

    • @harshvardhanpatil5248
      @harshvardhanpatil5248 3 года назад

      @@codeitup thankyou sir ji for quick and helpful reply

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

    Sir thanks

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

    Thank you sir.

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

      Most welcome🙂

  • @Suryabhai-b1n
    @Suryabhai-b1n Год назад

    Nice

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

    Great video content sir!

  • @himanijain4768
    @himanijain4768 3 года назад

    Thankyou!!!!!!!

    • @codeitup
      @codeitup  3 года назад

      Most welcome Himani!

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

    thank you sir

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

      Welcome Varsha 🙂

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

    Tnq u

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

    Thanks bhai

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

      Thanks Shubham !

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

    thank yous sir!!

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

      Most welcome!🙂

  • @umamansari4040
    @umamansari4040 3 года назад

    Super

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

    Sir isi trh ka interview level ka ek hi full video bna dijiye sir pllz

  • @jatinsharma3792
    @jatinsharma3792 3 года назад +1

    n = str(input("write your number: "))
    a = int(n[0])
    b = int(n[1])
    c = int(n[2])
    sum = ( a + b + c )
    print(sum)

  • @zzz-xg3fb
    @zzz-xg3fb 4 года назад

    Superrr

  • @ShadabAnsari-dt4ni
    @ShadabAnsari-dt4ni 3 года назад

    i=int(input('enter value'))
    sum=0
    while i>0:
    sum=sum+i%10
    i=int(i/10) #i=i//10
    print('sum',sum)

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

    sum=2+4+8
    print(sum)
    ⬆️This is a easy way to find sum of digit of a number. 😎😎

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

      I know you are joking but we are actually taking input from user.

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

    Please share the playlist of all these questions

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

    Easiest__We can also apply it
    s=input()
    sum=0
    lt=[]
    for i in s:
    lt.append(i)
    for i in lt:
    sum=sum+int(i)
    print(sum)

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

      integers are not iterable bro..... so this will not work

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

      @@nikhilbordekarHe is iterating a string not integer brother

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

    sum=0
    num=int(input("enter the number: "))
    while(num!=0):
    temp=num%10
    sum=sum+int(temp)
    num=num/10
    print("sum of the digits is:",sum)
    🤔🤔🤔

  • @subhasnatua775
    @subhasnatua775 3 месяца назад

    Sir amake to calculate the sum of the first "n" whole numbers, where "n" is limit accepted from the user. Ai program ti kibhabe koribo..

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

    Txxxx

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

    Sir digit number koi sa le agar toh har baar 10 se hi modulus krna hai kya ?

  • @meenukevlogss
    @meenukevlogss 3 года назад +3

    If int is 201 then condition gone wrong in while loop 🙄
    What to do for that case?

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

      Nope, I think you're confused in i//10, as after 1 the n will become 20 which gives the condition r = 2 .. And when you sum the digit we got 3 in this case the program will be done only in 2 steps .. I think I'm bad in explaining lol

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

    Sir, Is question ko krne ka bass yahi ek tarika hai ya koi aur bhi method ho skta hai??

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

      Koi bhi ek question banane ke bahut sare tarike hote hai ! Aur bhi tarike hai..

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

      @@codeitup ha sir bass wahi confirm krna tha, thank you

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

    Sir , why we choose always 10 value after modulus please explain, can we write another value just like 15, 20 etc.

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

      Because we are extracting the frace value of each of the digits at 10s place, 100s place, 1000s place etc, which is possible by dividing the number only with 10.

  • @wariot56
    @wariot56 3 года назад

    can u please make a video of these by using for loop

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

    sir can we use this program?
    n=int(input("Enter a number"))
    x=str(n)
    sum=0
    for i in x:
    y=int(i)
    sum+=y
    print("Sum of digits of",n,'=',sum)

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

      instead of putting n=(int(....)) and then converting it to string. You can directly get input in for of string. No need for conversion.

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

      @@danishhasan7123 ya best way__take input as a sting

  • @DevSharma-no1gl
    @DevSharma-no1gl 3 года назад +1

    Sir maine ye hi coding kari but
    Maine agar 344 dala to
    Output araaha hai
    Sum is 4
    Sum is 8
    Sum is 11
    3 step aarahe hai

    • @akankshu_nagi11
      @akankshu_nagi11 3 года назад

      same here,please tell how you resolve that issue

    • @gamingzone-zi6ty
      @gamingzone-zi6ty 3 года назад

      Bhai print statement ko loop se bahr nikaldo space clear krke

    • @akankshu_nagi11
      @akankshu_nagi11 3 года назад

      @@gamingzone-zi6ty thanks bro!! but i already resolve that

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

    Sir " i=i//10 " ki jagah
    " i=int(i/10) " bhi use ho sakta hai na..?

    • @codeitup
      @codeitup  3 года назад

      Hnji Kar sakte hai...

    • @samkitjain148
      @samkitjain148 3 года назад

      @@codeitup Sir ek doubt hai :
      In python add 10 to even and subtract 2 from odd numbers..
      I tried something like :
      for i in (listname):
      If i%2==0:
      X=i+10
      List[i]=X
      (And then the else statment...)
      But its some kind of run-time error,"list index out of range"..

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

    sir app ne bataya tha ki while ko run karne keliye 3 condition hoti h per iss video no. 22 me wo condition kase apply ho rhi h please tell ....

  • @sr5477
    @sr5477 3 года назад

    Sir app bahut achha padhate hai...but I forget in exam...what to do

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

    why we took % 10 sir, please explain i didn't understand

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

    Sir agar Negative numbers k Digits kaa sum karna ho toh???? 🙂

    • @Halwahaikya-l4v
      @Halwahaikya-l4v 10 месяцев назад

      Bus usme ek - sign add kardo print wali statement mai

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

    done

  • @lionelmessi8177
    @lionelmessi8177 3 года назад

    Sir can you tell another method to do this program please tell sir🙏

  • @shreyagarg870
    @shreyagarg870 Год назад +4

    can anyone explain why this is not working for 999

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

      n=int(input("Enter a number"));
      Sum=0;
      while(n>0):
      rem=n%10;
      Sum=Sum+rem;
      n=n//10;
      print(Sum);
      Is working for 999

    • @scpkingofmirzapur
      @scpkingofmirzapur 3 месяца назад

      The trick given by anand sir is working for 999 i got 27

    • @tejasj2428
      @tejasj2428 3 месяца назад

      It's working bro

  • @SriKanthKola
    @SriKanthKola 3 года назад

    how to print the sum for this string (1time3 %times4) 1+3+4=8

  • @soniczombojo2468
    @soniczombojo2468 10 месяцев назад

    Tho fir singke digit aaney keliye kasia karna hain

  • @shenron_editz
    @shenron_editz 10 месяцев назад +1

    Sir, this program can be done using for loop? Cause I made a program to do it.
    here is the code :
    # wap to add square of digit of a given number
    n=int(input("Enter the Number : "))
    i=0
    sum=0
    for i in range(1,n):
    sum=sum+(n%10)**2
    n=n//10
    print(sum)
    please reply, if there is any error

  • @rdxvikrant8608
    @rdxvikrant8608 5 лет назад +2

    sir next video ka link de diya kariye please

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

      Tutorial series step by step hi hai.

  • @ashishsrivastava371
    @ashishsrivastava371 3 года назад +1

    Sir iss program ka kuchh alternate tarikka hain ???

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

    if i given input 13 it is showing output as 3 and 4 y

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

      Print sum after the loop closes.

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

    Sir, How much important this program..? Just because I want to skip this

  • @PRADEEPCHOUDHARY.
    @PRADEEPCHOUDHARY. 4 года назад +1

    Ye program using recursion function kaise banega .....

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

      def sum_of_digit( n ):
      if n == 0:
      return 0
      return (n % 10 + sum_of_digit(int(n / 10)))
      num = int(input("Enter Number:"))
      result = sum_of_digit(num)
      print("Sum of digits in",num,"is", result)

    • @PRADEEPCHOUDHARY.
      @PRADEEPCHOUDHARY. 4 года назад +1

      @@codeitup Thanks.....isme if n==0 hoga ya if n< 10 hoga
      Ya dono sahi h sir

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

    Sir sum =0 compulsory h kya

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

    multiplication =1
    multiplication =multiplication *i%70
    ऐसा कर सकते हैं क्या multiplication करणे के लिये

  • @fenrir834
    @fenrir834 3 года назад +1

    carryminati
    technical guruji
    bb ki vines
    yaar ye tags kyu use kar rahe ho?

  • @SahilSingh-fe2qw
    @SahilSingh-fe2qw 2 года назад

    Aise print krna ho to
    4625
    4+6+2+5 =17
    1+7 =8

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

    Any other way to solve this?

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

      Statement may be written in different ways but the concept will be same Tanmay.🙂

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

      @@codeitup alright.

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

    Bro if i give input in your code like 123
    Output like
    3
    5
    6
    But why?

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

    sir isme humne (i>=0): kyu nhi liya?

    • @AbhinavSharma-ff9mo
      @AbhinavSharma-ff9mo Год назад +1

      Because it will give us the same result.that's why we simply used (i>0)

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

      @@AbhinavSharma-ff9mo thnx bruh

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

    Why did we take 10 int in program??

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

      We can take any number not only 10. Its just the concept.

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

    sir why is %10 used??

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

      To get the last digit Aditi !!!

  • @ArunKumar-mf9zj
    @ArunKumar-mf9zj 4 года назад

    Tanks sir but sir mere pass pc ya laptop nahi he to me kese program kro

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

      You can use qpython app for running python app..

    • @ArunKumar-mf9zj
      @ArunKumar-mf9zj 4 года назад

      @@codeitup sir naam btana app ka

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

    Sir = kyo nhi dala while me

    • @PrakashChandraDas-m4o
      @PrakashChandraDas-m4o 6 месяцев назад

      If i>=0,then
      Then there will be two cases to consider
      i>0
      and i=0
      If i=0, then i=sum[since, sum =0]
      which means the loop will not repeat and therefore the program will remain unexecuted

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

    how to take multiple inputs like
    Input Format
    =================>
    Input : 3 12345 31203 2123
    Constraints
    Constraints - 1 ≤ T ≤ 1000 1 ≤ N ≤ 1000000
    Output Format
    Output : 15 9 8

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

    sir sum=sum +i%10
    yha 10 kyu liya aapne

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

      Kyoki 10 se divide karke remainder haesha last digit aata hai..

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

      @@codeitup got it sir

  • @PKTECHIE26
    @PKTECHIE26 3 года назад

    Thanks sir 🤗

    • @codeitup
      @codeitup  3 года назад

      Always welcome😊

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

    Thank you Sir