>>"(1) how to capture number of occurrences of 3 between 1 to 100? "

Write a for loop that counts from 1 to 100. Convert each int value to a string then test the string if it contains a '3'.

2) Do you know how to declare a function pointer? Almost like declaring a function prototype. For example, if you have a function that takes an int parameter and returns an int, then a function pointer might be int (*fn)(int);

>>It seems that there is 10 3's in every 100;
There are 19 numbers between 1 and 100 that contain one or more 3s. 3 13 23 30 31 32 33 34 35 36 37 38 39 43 53 63 73 83 93 I thought about the mod operator too, but it won't work. Example: Enter max num = 100. 100 % 100 == 0, which is clearly wrong answer.

A common way to separate a number into digits is to use % and / like this.

#include <stdio.h>
int main()
{
int i;
for ( i = 1; i <= 100; ++i )
{
int value = i;
printf("value = %d\n", value);
while ( value )
{
int digit = value % 10;
printf(" digit = %d\n", digit);
/* now if there were only some way to check if digit were 3 here */
value /= 10;
}
}
return 0;
}

You might find 20 3's from 1 to 100 if you counted both 3's in 33.

Hi my friend Ancient Dragon, thank you very much for your kind concern on my problem.Yes its true I was not aware on Function Pointer and with your awareness I solved the second problem.It's really a great concept in the programming language.The logic of the first problem almost like my friend Dave Sinkula has said as at the number 33 number 3 has come twice.So number of occurrence of 3 is equal to 20.Actually it my mistake that I'm not clearly express my problem. And first problem also be solved.

dear friend firstperson,I'm very thankful that you are really a first person to concern on my problem.As on my problem is about the number of occurrence of 3 between 1 to 100 so it should be 20 as at number 33,3 comes twice.It is my mistake to express the problem clearly.And I've solved this problem with all of your suggestion because logic behind this problem is same for everyone.
Thank you very much for your suggestion and I'll be glad if you will be with me as my friend.

My friend Dave Sinkula. I'm thankful to you as you give the deep attention on my first problem.Your logic is almost same,almost because in your program all the digit has been shown separately but digit should be show when 3 has occurred and simultaneously count each time of occurrence and shown when it occurred and number of total occurrence.So this is only some modification my friend. And second problem has also been solved with the awareness of Ancient Dragon.At the end I can only say be my friend as right now.

Thank you very much for your suggestion Dave Sinkula.

My friend VernonDozier, as I said number of occurrence of 3 so

30, 31, 32, 34, 35, ...?

should also be count.I'm really thank full to your for your attention on my problem.Whenever I'll face any problem on programming language you pleas be with me.

I am having a trouble not knowing how to do a java code that will take user string then encrypt it using Elgamal algorithm as following
Elgamal algorithm Pseudo code: ...

A few weeks ago my laptop browsing and windows apps error. When i am on my facebook account i can watch youtube videos posted on feeds but other videos pos ...