Program to count digits in a number in C language

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.พ. 2025
  • Like, Comments, Share and SUBSCRIBE

ความคิดเห็น •

  • @damineeverma2567
    @damineeverma2567 5 ปีที่แล้ว +4

    Sir... Aapke her video really mujhe c programming me coding aur logic me improvements karaa rahi h........

  • @sjamal4403
    @sjamal4403 6 ปีที่แล้ว +16

    I am extremely thankful to ALLAH for giving us Sir Saurabh Shukla as The Best Teacher, who teaches programming with excellent, efficient, and comprehensive expertise. Alhumdulillah

    • @lakhichetry3803
      @lakhichetry3803 4 หลายเดือนก่อน

      Aʟʟᴀʜ ʙᴏᴊʀɪᴋᴇ 😅😅😂😂😂

  • @arjungurjar4600
    @arjungurjar4600 8 ปีที่แล้ว +2

    Sir , You're the best in the world . I've never seen a person like you on the whole youtube , have this much of intuitive understanding of programming skills . Thank you very much for all your enlightening videos .

  • @sjamal4403
    @sjamal4403 6 ปีที่แล้ว +3

    I have learnt to build program logic just because of Sir Saurabh's best lectures.

  • @pradeepkumar-uy2oo
    @pradeepkumar-uy2oo 7 ปีที่แล้ว +1

    Best computer teacher I ever seen...thanks a lot sir for helping us to understand the programming..before this this was mystery to me..now "I can" by learning from ur videos...thanks u sir again from the bottom of my heart..we need more teachers like you. ✌👍

  • @PRABHATKUMAR-gy5tl
    @PRABHATKUMAR-gy5tl 6 ปีที่แล้ว +1

    awesome videos sir , you are great sir

  • @fazalmohammed2946
    @fazalmohammed2946 4 ปีที่แล้ว +1

    Mubarakk sir 600k soon😍😍

  • @ABHISHEKCHAUDHARY-dj1ry
    @ABHISHEKCHAUDHARY-dj1ry 5 ปีที่แล้ว +1

    sir u r grate
    kitna aacha samajate hai aap

  • @jyotijaiswal6257
    @jyotijaiswal6257 4 ปีที่แล้ว

    teaching skills too good sir thank you

  • @soumitadutta9081
    @soumitadutta9081 6 ปีที่แล้ว +4

    sir I made it with for loop.my logic was :-
    int x,count;
    for (count=1; ; count++)
    {
    x=x/10;
    if(x==0)
    break;
    }
    printf("total digits are %d", count);
    I did dry run n then tried it on my laptop..it was perfectly fine.😍

  • @babulpegu2678
    @babulpegu2678 6 ปีที่แล้ว +1

    really sir..very helpful video..

  • @shraddhapawar5674
    @shraddhapawar5674 3 ปีที่แล้ว

    Thank you sir, you helps us lot,
    Mujhe ek din aapko jarur milna hai.

  • @mukundrathi2208
    @mukundrathi2208 7 ปีที่แล้ว +2

    Sir, i am very happy, thank you for your tutorials, I tried to write a program to function the above-required result and it worked correctly in its 1st attempt itself....
    main()
    {
    int a,b,c,d;
    printf("Enter a number : ");
    scanf("%d",&a);
    for(b=1;b

  • @bigbull9454
    @bigbull9454 2 ปีที่แล้ว +1

    Thanks 🙏 sir

  • @muddassir1975
    @muddassir1975 5 ปีที่แล้ว

    You are a great teacher.
    Thanks.

  • @aryanjoshi6324
    @aryanjoshi6324 6 ปีที่แล้ว

    the way of teaching is good

  • @rushirajparmar9602
    @rushirajparmar9602 7 ปีที่แล้ว +2

    thankyou sir!!it was a wonderfull explanation

  • @Itsrealfacts
    @Itsrealfacts 5 ปีที่แล้ว +1

    Only four word you are the best

  • @unknownbadshah1094
    @unknownbadshah1094 6 ปีที่แล้ว +4

    Sir, ye program sirf 10 numbers tk hi count kr rha hai agr usse jayda values user ne input kr diye to phr to program glt result dega.

  • @anshikabansal5642
    @anshikabansal5642 3 ปีที่แล้ว

    Thanku so much sir
    U are excellent

  • @sagarrohilla396
    @sagarrohilla396 8 ปีที่แล้ว +1

    hello sir! your videos are very helpful and these will enhance my programming skills for sure!! I want you to do some more programs from topic pointers!!! because pointers is little bit confusing! hope you will consider the same!!! thank you again!

  • @deepak1952
    @deepak1952 6 ปีที่แล้ว +2

    From Nepal thank you for every thing

  • @anupkumar2736
    @anupkumar2736 8 ปีที่แล้ว +6

    sir! when i am entering a number consisting of more than 5 digits, the output doesn't come desirable.
    what would be the probable solution for this particular problem??

    • @sultanasaifi9498
      @sultanasaifi9498 5 ปีที่แล้ว +9

      This is happening because the range of int is -32768 to 32767 . For number having more than 5 digits you have to exceed the range like take long int instead of int.

    • @khushboogarg5684
      @khushboogarg5684 4 ปีที่แล้ว +1

      How can we extend....pls mam explain as

    • @ajitdubey6503
      @ajitdubey6503 4 ปีที่แล้ว

      @@sultanasaifi9498 long int lene ke bad bhi nhi aa rha

    • @rishikumar9271
      @rishikumar9271 4 ปีที่แล้ว +2

      Try this,
      It works for counting characters also.
      void main()
      {
      int i;
      char s[30];
      clrscr();
      printf("Enter your address");
      gets(s);
      i=strlen(s);
      printf("Total charaters in your address=%d",i);
      getch();
      }

    • @champions8663
      @champions8663 4 ปีที่แล้ว

      @@ajitdubey6503 double long try kro

  • @NehaSingh-kc2yr
    @NehaSingh-kc2yr 7 ปีที่แล้ว +3

    Sir good morning ,how to calculate a particular number frequecy in any inputted number .for example 23456 is an inputted by programmer if I want in this given number 4 has how many times comes in this inputted number

  • @chauhanbhavika3276
    @chauhanbhavika3276 6 ปีที่แล้ว

    You are great sir

  • @sohelshaikh9678
    @sohelshaikh9678 2 ปีที่แล้ว

    Thanks you so much sir 🥺😘

  • @sameoldcorner
    @sameoldcorner 4 ปีที่แล้ว +2

    Thank you for such a clear explanation sir but I had a doubt that what if the user inputs 0000 ( x = 0000)? They are digits as well but according to the condition these digits will not be counted. So, how can I make a program that will count digits in a number including 0s.
    Thank you !

  • @pushpbhardwaj4176
    @pushpbhardwaj4176 5 ปีที่แล้ว +1

    Sir agar koi large number enter krte hai to answer wrong kyu aa rha hai.
    ....Count ki value 5 se jada nhi ho sakti kya?

  • @rahimshaikh4183
    @rahimshaikh4183 3 ปีที่แล้ว +1

    Respected sir,
    We cannot count 0 as a digit?
    Plz .. explain me

  • @pooshanarora6856
    @pooshanarora6856 8 ปีที่แล้ว +2

    execellent explanation

    • @techguy8883
      @techguy8883 4 ปีที่แล้ว

      fghfghhhjghjgjbn

  • @pragyarathor4945
    @pragyarathor4945 6 ปีที่แล้ว

    nice explanation

  • @shwetapandey2406
    @shwetapandey2406 8 ปีที่แล้ว

    nice explanation sir

  • @lovepratapgurjar8808
    @lovepratapgurjar8808 2 ปีที่แล้ว

    kya aapka logic ten digit se upr bhi kaam krta he?????
    plzzz reply

  • @AdnanKhan-vt7kf
    @AdnanKhan-vt7kf 4 ปีที่แล้ว

    Sir g jab 10 se zyada numbrs inter karly to phir bhi total digit 10 out put dekata hain kya masla hain sir.

  • @Shivam.Yadav.002
    @Shivam.Yadav.002 3 ปีที่แล้ว

    Thanks sir

  • @MunnaKumar-pb3jb
    @MunnaKumar-pb3jb 7 ปีที่แล้ว +2

    Sir ,
    how can i make this program in for loop.

  • @DogoodGetGood354
    @DogoodGetGood354 6 ปีที่แล้ว

    nice

  • @chiefsuraj8537
    @chiefsuraj8537 3 ปีที่แล้ว

    sir iss me jab tak hum five digit ka ya uss se kam digit ka number input karte hain tab tak to yeh program thik hai jab hum 5 se upper ki number add karvate hain tab answer 1 aa jata hai.esa kyo ??

  • @sibanandaroutray7934
    @sibanandaroutray7934 4 ปีที่แล้ว

    Sir 🙏🙏🙏
    If I entered more than 5 digit results not correct.

  • @shivshankarmaury2745
    @shivshankarmaury2745 7 ปีที่แล้ว +4

    sir when we enter more than 5 number it count =0
    what's is the problom

  • @rajpandey5337
    @rajpandey5337 7 ปีที่แล้ว +1

    sir gives more recursive approach videos

  • @languagelearning12
    @languagelearning12 3 ปีที่แล้ว

    why we can not write in while loop as i=x/10; sir Answer please🙏

  • @HKNAGPAL7
    @HKNAGPAL7 7 ปีที่แล้ว +2

    Nice : )

  • @AnkitSingh-tz1wt
    @AnkitSingh-tz1wt 4 ปีที่แล้ว

    What is the code if we write above program by using only for loop...no if else

  • @strugglers3695
    @strugglers3695 8 ปีที่แล้ว

    void main()
    {
    int count=0,x;
    printf("enter a number");
    scanf("%d",&x);
    while(x!=0)
    {
    x=x/10;
    count++;
    }
    printf("total digit is %d",count);
    } sir is program me agar 10 se jyda digit dalta hun to to ouput 10 hshow krta h?
    aisa kyun sir???

  • @farooqueraza2336
    @farooqueraza2336 5 ปีที่แล้ว +1

    Sir total digits greater then 10 are not acceptable in this program.....Why?????

    • @usamakhan294
      @usamakhan294 5 ปีที่แล้ว

      not only greater than 10 but also greater than 5 ...

  • @rajnishkumar3249
    @rajnishkumar3249 3 ปีที่แล้ว +1

    I think it has a minute mistake like when we enter zero it shows zero digit but via concept of significant digit if we have trailing zeroes then we will not count but if we have a number which has only zero then here we will count only one zero i.e. conclusively zero is a digit, so it should show 1. the question will be correct if we include "NATURAL" befor enumber.

  • @ashishsoner3348
    @ashishsoner3348 6 ปีที่แล้ว

    Can we solve this problem for loop also? Plz reply

  • @saadulhasnain4675
    @saadulhasnain4675 8 ปีที่แล้ว +10

    i wish my C instructor explains in the same way as you do..

    • @saadulhasnain4675
      @saadulhasnain4675 8 ปีที่แล้ว

      indeed, you are Sir!

    • @saadulhasnain4675
      @saadulhasnain4675 8 ปีที่แล้ว +3

      Sir by the grace of Almighty, i have cleared by lab exam of C. Your videos proved to be blessings for me. your videos helped me immensely in clearing my lab exam.

    • @saadulhasnain4675
      @saadulhasnain4675 8 ปีที่แล้ว

      now upcoming is my theoretical paper of C. so kindly guide me regarding that.

  • @pawanbishnoi282
    @pawanbishnoi282 6 ปีที่แล้ว +1

    thank you sir

  • @unknownsbots
    @unknownsbots 5 ปีที่แล้ว +1

    How to make tally counter

  • @Sports_info12
    @Sports_info12 3 ปีที่แล้ว

    Sir main programing strong kaise kru pls help me sir...

  • @jayanth.s1008
    @jayanth.s1008 6 ปีที่แล้ว +1

    Thnking you

  • @Hellow_world108
    @Hellow_world108 2 ปีที่แล้ว

    Thanqu sir

  • @avishekkumar9336
    @avishekkumar9336 7 ปีที่แล้ว

    how can we separate an integer from a string and store it into another variable???
    ex: input: Ab4
    separate 4 into another variable i.e. x=4
    and print a
    i.e. output=4

  • @shrisheekumari2998
    @shrisheekumari2998 4 ปีที่แล้ว

    Sir if se ho sakta hai count digits

  • @TechProgrammingIdeas
    @TechProgrammingIdeas 3 ปีที่แล้ว

    Thanks

  • @hariomkumar163
    @hariomkumar163 6 ปีที่แล้ว

    Thanks a lot

  • @rishabhmittal2215
    @rishabhmittal2215 3 ปีที่แล้ว

    Sir, What if i will type 0 as it is a single digit. but it will give ans as 0

  • @vickykumarmahato2631
    @vickykumarmahato2631 6 ปีที่แล้ว

    thank you so much

  • @ashutoshpatidar5692
    @ashutoshpatidar5692 7 ปีที่แล้ว

    Sir how to count the number of active objects in a cop program having static data members and member functions

  • @anasali4445
    @anasali4445 8 ปีที่แล้ว

    Hello sir i am facing one problem & problem is that this is working correctly for 5 digit number. but if i enter 6 digit number so it is giving me output as 4 digits number.

  • @tapashdas741
    @tapashdas741 3 ปีที่แล้ว

    Sir ek programme karke digiye. Wap to input 5th digit no and print its second and 5th digit

  • @ananyaraje921
    @ananyaraje921 3 ปีที่แล้ว

    Sir plz make video to find generic root of number using while loop..

  • @rishabhpathak1367
    @rishabhpathak1367 4 ปีที่แล้ว

    How to calculate if any digit repeat

  • @ankitnegi4626
    @ankitnegi4626 6 ปีที่แล้ว

    Sir when I enter more than 5 number in x so it's show tha only 5 or 4 digit .
    Ex- x= 123456
    Output = 4
    If I entered 1234567 so,
    It show Output is only 5.

  • @kumargaurav7622
    @kumargaurav7622 6 ปีที่แล้ว

    when i entered 6 or more digits why it is giving only 4 as output?

  • @dimple1146
    @dimple1146 7 ปีที่แล้ว +1

    Sir, why you have written void in this program?

  • @subhojitkumarmahato3761
    @subhojitkumarmahato3761 7 ปีที่แล้ว

    Sir , why modulus doesnt work ??

  • @iramidrees7060
    @iramidrees7060 8 ปีที่แล้ว +1

    Thankyou very much :-)

  • @biplabchakraborty4302
    @biplabchakraborty4302 7 ปีที่แล้ว

    Sir up to 10 digits it working properly but after 10 digits its get wrong answer.Sir please reply.

    • @muhammadumerbaig3607
      @muhammadumerbaig3607 7 ปีที่แล้ว

      bro the variable in which you store the number as you may set it to LONG LONG INT instead of only INT than it work for numbers bigger than 10 digits too ..hope it works

    • @ajitdubey6503
      @ajitdubey6503 4 ปีที่แล้ว

      @@muhammadumerbaig3607 nhi ho rha hai bhai

  • @princesingh6932
    @princesingh6932 5 ปีที่แล้ว +1

    Sir!! What? If we put "0" As a digit... The answer will be wrong. So we should use do-while loop in case of while loop. That'll be more correct

  • @kumkumsoni4820
    @kumkumsoni4820 5 ปีที่แล้ว +1

    Sirr glt output aa rha agr 5 ye bda digit de rhe to.. Plse help kre

  • @kurbanalimasu4895
    @kurbanalimasu4895 6 ปีที่แล้ว

    sir when we input 0 in this program , what will happen ?
    tell me as fast as

  • @gujjukimasti9720
    @gujjukimasti9720 4 ปีที่แล้ว

    but sir 0 is also digit or not ?

  • @AmitSharma-xd1dy
    @AmitSharma-xd1dy 7 ปีที่แล้ว

    How to find digit in a number is range of digit is( 0

  • @tanushreenagar3116
    @tanushreenagar3116 6 ปีที่แล้ว

    Sir but it cant count digits when we insert 0 in between plzz help

  • @jo5244
    @jo5244 8 ปีที่แล้ว

    sir can u upload a vedio of program to find the position of number which we want to search!!

  • @atiqulahmed4686
    @atiqulahmed4686 9 ปีที่แล้ว

    sir whn u upload computer organization architecture?? plz rply sir ??

    • @atiqulahmed4686
      @atiqulahmed4686 9 ปีที่แล้ว +1

      Thnx fr informing !!

    • @HKNAGPAL7
      @HKNAGPAL7 7 ปีที่แล้ว

      ATIQUL AHMED how he replied?

  • @bciv165_gouravpanjnathia5
    @bciv165_gouravpanjnathia5 3 ปีที่แล้ว

    Sir plz upload program on how to count frequency of digits in an integer number given by user

  • @naweenmahto3103
    @naweenmahto3103 5 ปีที่แล้ว

    Write a program to print immediate next prime number of a given number.
    could you please tell me the logic for this program?

  • @jyotipatro743
    @jyotipatro743 4 ปีที่แล้ว

    Sir I have another logic for this program...

  • @ehtashamather6574
    @ehtashamather6574 7 ปีที่แล้ว

    sir if i enter 0 this it gives 0 digits then i use do while loop its print correct but then i enter 000 this also gives 1 digit? why and how to fix it plz reply.....

  • @ayushjain9557
    @ayushjain9557 4 ปีที่แล้ว

    sir this program does not work for more tha n 5 digits

  • @akroshrathod5381
    @akroshrathod5381 5 ปีที่แล้ว

    Sir count minus main kyun display ho raha hai

  • @trishalarora6619
    @trishalarora6619 7 ปีที่แล้ว

    Sir ji is logic se sare sahi aa rhe hain but agar Mai input me 0 likh rha hu to answer 0 aa rha hai Lekin Anna to 1 chahiye. Pls tell sir.

  • @yupp_harish3936
    @yupp_harish3936 7 ปีที่แล้ว

    I need a program of.
    Calculate digits of a number.
    And print printf .
    Matlab jitne numbers hoge utne print f print hona

  • @kshitijkumar9029
    @kshitijkumar9029 6 ปีที่แล้ว

    How to find middle digit of a long integer number in c

  • @saquibajaz5007
    @saquibajaz5007 7 ปีที่แล้ว

    sir isme printf ("%d",count);ko loop k bahar kyu kiya hai

    • @mysirgdotcom
      @mysirgdotcom  7 ปีที่แล้ว

      because isko repeat nahi karna hai

    • @ajitdubey6503
      @ajitdubey6503 4 ปีที่แล้ว

      @@mysirgdotcom sir 5 digits se bada number enter karne par garbage value aa rha hai .aap isaka answer kyu nhi de rhe hai sir bahut logo ne question kiya hai but aap reply nhi kar rhe

  • @RajendraSingh-br5zl
    @RajendraSingh-br5zl 5 ปีที่แล้ว

    Put input 00 ..It will show o/t as 0 instead of 2 ..

  • @prasannajoshi2645
    @prasannajoshi2645 6 ปีที่แล้ว

    What if there is a decimal no.?

  • @rashijain3762
    @rashijain3762 8 ปีที่แล้ว

    sir more than 6 digits if we entered the answer will be wrong... plz solve this

  • @prashantverma9457
    @prashantverma9457 4 ปีที่แล้ว +1

    It's not working for 12 digits

  • @vikashchoudhary7216
    @vikashchoudhary7216 7 ปีที่แล้ว

    what if we enter 0 as the number. The output should be 1 but here the output will be 0.

  • @shivamgoyal9844
    @shivamgoyal9844 7 ปีที่แล้ว

    what if we enter a number 000 the output should be 3 but output is 0?

    • @mysirgdotcom
      @mysirgdotcom  7 ปีที่แล้ว +4

      The number is still 0. The number 000 is same as 0.
      If you want to yield result of input 000 as 3, you can treat input not as a number but string and deduce the length of the string

  • @angadyadav3409
    @angadyadav3409 3 ปีที่แล้ว

    sir 5 ya jada digit wale number ka output galat aaraha hai

  • @saranyapandey
    @saranyapandey 6 ปีที่แล้ว

    how to count digits using for loop

  • @unboxingtechnology9697
    @unboxingtechnology9697 6 ปีที่แล้ว

    it doesn't work if x=0 as if x=0 then the body of while loop will not execute and printf will print 0 but 0 has one digit

  • @shashankpandey9035
    @shashankpandey9035 5 ปีที่แล้ว +2

    they are not counting '0", what if i also what to count '0' as a digit

    • @prashantpandya6992
      @prashantpandya6992 4 ปีที่แล้ว

      Exactly..

    • @rishikumar9271
      @rishikumar9271 4 ปีที่แล้ว

      Try this code,
      It's works for counting characters also.
      void main()
      {
      int i;
      char s[30];
      clrscr();
      printf("Enter your address");
      gets(s);
      i=strlen(s);
      printf("Total charaters in your address=%d",i);
      getch();
      }

  • @abhinavsinha8947
    @abhinavsinha8947 5 ปีที่แล้ว

    Sir yeah for se kaise hoga