Program to count digits in a number in C language

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 พ.ย. 2024

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

  • @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 หลายเดือนก่อน

      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 5 ปีที่แล้ว +1

    awesome videos sir , you are great sir

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

    sir u r grate
    kitna aacha samajate hai aap

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

  • @sameoldcorner
    @sameoldcorner 3 ปีที่แล้ว +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 !

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

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

    teaching skills too good sir thank you

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

    Mubarakk sir 600k soon😍😍

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

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

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

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

    really sir..very helpful video..

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

    From Nepal thank you for every thing

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

    Only four word you are the best

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

    Thanku so much sir
    U are excellent

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

    You are a great teacher.
    Thanks.

  • @NehaSingh-kc2yr
    @NehaSingh-kc2yr 6 ปีที่แล้ว +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

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

    the way of teaching is good

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

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

    thankyou sir!!it was a wonderfull explanation

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

    Thanks you so much sir 🥺😘

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

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

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

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

    Thanks 🙏 sir

  • @pushpbhardwaj4176
    @pushpbhardwaj4176 4 ปีที่แล้ว +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

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

    You are great sir

  • @princesingh6932
    @princesingh6932 4 ปีที่แล้ว +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

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

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

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

  • @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 4 ปีที่แล้ว +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

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

    nice explanation

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

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

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

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

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

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

    Can we solve this problem for loop also? Plz reply

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

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

    execellent explanation

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

      fghfghhhjghjgjbn

  • @AyeshaKhan-cd4kj
    @AyeshaKhan-cd4kj 2 ปีที่แล้ว

    Thank you sir

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

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

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

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

    nice explanation sir

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

    sir gives more recursive approach videos

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

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

    Nice : )

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

    Thanks sir

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

    nice

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

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

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

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

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

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

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

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

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

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

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

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

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

    thank you so much

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

    Sir if se ho sakta hai count digits

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

    Thanks a lot

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

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

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

    How to make tally counter

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

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

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

    Thanks

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

    Thanqu sir

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

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

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

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

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

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

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

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

    Thankyou very much :-)

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

    Sir I have another logic for this program...

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

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

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

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

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

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

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

    Thnking you

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

    How to calculate if any digit repeat

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

    but sir 0 is also digit or not ?

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

    your this code will not work when the input number will be '0'. It will give output 0. But the answer should be 1. Since 0 is also a digit.

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

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

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

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

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

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

    What if there is a decimal no.?

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

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

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

    Sir , why modulus doesnt work ??

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

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

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

    THIS PROGRAME CAN'T COUNT A NUMBER MORE THAN 5 DIGITS! WHY? IS THERE 'INT KEY WORD MEMORY PROBLEM?

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

    Sir, why you have written void in this program?

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

    To count the number of notea in the given amount ye program provide kar den sir

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

    This program goes only till 10 it cant check more then 10 digits. Helppp

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

    Sir count minus main kyun display ho raha hai

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

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

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

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

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

      Thnx fr informing !!

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

      ATIQUL AHMED how he replied?

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

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

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

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

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

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

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

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

    how to count digits using for loop

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

    Sir yeah for se kaise hoga