answersLogoWhite

0

There are some ways to do it. Here I give you an example.

You can do it if you take the input as string.

#include <stdio.h>

#include <string.h>

main(void)

{

int i, count = 0;

char ch[10000];

gets(ch);

int len = strlen(ch);

for(i = 0; i < len; i++)

{

if(ch[i] == '1')

{

count++;

}

}

printf("Number of times one occurs: %d\n", count);

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How many times does the number one occur between 1 and 120?

I count 53 times.


How many times does the number 3 occur in the count 1 to 100?

20


What is the program counter?

Counters in basic are used to count a number of times a process is being used.


How many times does the number 7 occur in the count 1 to 100?

The number 7 occurs once. The digit 7 occurs 20 times.


How do you find the experimental probability that a particular result will occur?

You carry out the experiment a large number of times. Count the number of times it was carried out (n). Count the number of times in which the particular outcome occurred (x). Then, the experimental probability for that even is x/n.


When can program counter be used?

Basically, whenever you need to count something. One common scenario is when you need to repeat a program block a certain number of times - the counter variable will be used, in this case, to keep track of how many times the program block has already been executed.


Is it true that the probability of an event is the number of ways it can occur divided by the number of times it cannot occur?

No.


How do you count the number of times a loop runs in javascript?

The easiest way is to just use a loop variable. For example:var count = 0;for (var i in object) {if (object.hasOwnProperty(i) {count++;}}console.log(count);That will add to the count variable each time through the loop, so at the end it will be a count of the number of times the loop has run.


How many times was Princess said in Princess Protection Program?

I think its 86 if you count Princessa xxx


How many times would you encounter the number 9 when you count 1 to 100?

Twenty times.


Do DVDs count how many times they've been played?

Generally, a DVD is play only, so they have no way of recording the number of times they were played. However, if it is a re-writable DVD and contains a control program, then almost anything is possible.


What gives the number of times that a particular entry occur?

The frequency.