How many times 3 occurs between 3 to 3333

Showing Answers 1 - 32 of 32 Answers

hari

  • Jan 4th, 2006
 

It comes 998 times.

  Was this answer useful?  Yes

Moumita

  • Jan 15th, 2006
 

I am very sorry to say that you should give the trick inspite of giving the answer only.It will help us more.

  Was this answer useful?  Yes

SHAILESH

  • May 30th, 2006
 

how many times 3 occurs between 3 to 3333

  Was this answer useful?  Yes

ashish sinha

  • Jun 23rd, 2006
 

The number 3 never appears between 3 to 3333. The digit 3 does appear many times ... probably 998 times (or something like that, as the person above has mentioned). So the answer is 0.

  Was this answer useful?  Yes

siva

  • Oct 27th, 2006
 

Hi guys,I have written a code (in perl) to find it out.. what it does is it takes the numbers from 3 to 3333,divide each number into digits and checks whether it's 3 or not.. and increments the count..The answer I found out is 1336.my($i,$dig,$tmp);my($count)=0;for($i=3;$i<=3333;$i++){$tmp = $i;while($tmp!=0){$dig = $tmp%10;$tmp=$tmp/10;if($dig == 3){$count++;}}}print "$countn";

  Was this answer useful?  Yes

ghasagar

  • Apr 20th, 2007
 

see if this perl snippet works for you..

print "how many times 3 occurs between 3 to 3333?n answer:n";

my @nums = (3..3333);
foreach  (@nums) {
 my @tmp_counter = ($_ =~ m/3/g);
 $final_count += eval($#tmp_counter+1);
}
print "final : $final_count n";

output :
how many times 3 occurs between 3 to 3333?
 answer:
final : 1336

sagar

  Was this answer useful?  Yes

vijay

  • Jun 13th, 2007
 

main() {
int i=3,temp=0,d,c=0;
for(;i<=3333;++i)
{
 temp=i;
 while(temp!=0)
 {
  d=temp%10;
  if(d==3)
   c++;
  temp=temp/10;
 }

}
printf("%d",c); }



ans: 1336 times

pushpa

  • Oct 16th, 2011
 

1336

  Was this answer useful?  Yes

David

  • Nov 12th, 2011
 

3 as digit appear each 10 iterations. 3,13,23,33,43...

In each iteration I count number of digits with value of 3 and add to total sum.
Then increment number by 10

Code
  1. int& count3inNum(const int& number)

  2. {

  3.         int *res = new int(0);

  4.         int num = number;

  5.  

  6.         while(num/10>0)

  7.         {

  8.                 int dig = num%10;

  9.                 if(dig == 3)

  10.                         (*res)++;

  11.                 num/=10;

  12.         }

  13.         if(num%10 == 3)

  14.                 (*res)++;

  15.        

  16.         return *res;

  17. }

  18.  

  19. int HowManyTimes_3_InOccur(const int& num1, const int& num2)

  20. {

  21.         int num =3, res = 0;

  22.        

  23.         while(num<num2)

  24.         {

  25.                 res+=count3inNum(num);

  26.                 cout<<res<<endl;

  27.                 num+=10;

  28.         }

  29.        

  30.         return res;

  31. }

  Was this answer useful?  Yes

sridhar s l

  • Jan 19th, 2012
 

The answer is 1336

Code
  1. #include<stdio.h>

  2. #include<conio.h>

  3. #include<stdlib.h>

  4. #include<string.h>

  5. void main()

  6. {

  7.  int i,l,j,k=0;

  8.  char str[10];

  9.  clrscr();

  10.  for(i=3;i<=3333;i++)

  11.  {

  12.   itoa(i,str,10);

  13.   l=strlen(str);

  14.   for(j=0;j<l;j++)

  15.   {

  16.    if(str[j]==3)

  17.      k++;

  18.   }

  19.  }

  20.  printf("%d",k);

  21.  getch();

  22. }

  23.  

  Was this answer useful?  Yes

ASMIT BASU

  • Feb 18th, 2012
 

Code
  1. #include <stdio.h>

  2. #include <conio.h>

  3.  

  4. void main()

  5.  

  6. {

  7.  

  8. int f,r,i=3333;   //variable declaration       

  9. clrscr();              

  10.  

  11. while (i!=o)

  12. {

  13. r=i%10;         //calculating the remainder and if its 3 then the flag is imcreased by 1

  14.  

  15. if (r==3)

  16. {

  17. f= f++;

  18. }

  19.  

  20. i=i/10;         //reducing the number 3333 to 333 to 33 to 3

  21. }

  22.  

  23. if(i==3)        //if the last number left is 3 (since 3/10 would give 0) then increase the flag

  24. {

  25. f=f+1;

  26. }

  27.  

  28. printf("the number of 3s are %d", f);

  Was this answer useful?  Yes

Code
  1. #include<stdio.h>

  2. #include<conio.h>

  3. void main()

  4. {

  5. int i,j,k=0;

  6. for(i=3;i<=3333;i++)

  7. {

  8.         j=i%10;

  9.         if(j==3)

  10.         {

  11.                 k=k+1;

  12.         }

  13. }

  14. printf("times %d

  15. ",k);

  16. }

  Was this answer useful?  Yes

Dinesh

  • Sep 14th, 2012
 

1336

  Was this answer useful?  Yes

Naren

  • Aug 5th, 2023
 

from (0-9) there in 1 three
from (0-99) (including units and tens place) there are 20 threes
from (0-999) there are (20*10=200) threes + 100 threes (300-399) = 300 threes
therefore total number of threes from (0-2999) = 300*3=900 threes
then in (3000-3333)
in thousands place from(3000-3333) there are 333+1=334 threes
in 100s place from(3300-3333) there are ( 1+33) = 34 threes
in 10s place from(3000-3333) there are (10 +10 +10 +4) = 34 threes(4:3330,3331,3332,3333)
in 1s place from (3000-3333) there are (10 +10 +10 + 4) = 34 threes(4:3303,3313,3323,3333)
therefore total number of threes are = 1336

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions