answersLogoWhite

0


Best Answer

Let "n" is that number and "occ" is the no of occurrence of a element "el" in "n".

so,

<pre>

i = n;

occ = 0; // Initializing "occ" to zero.

while(i > 0){

rem = i % 10; // This gives a digit in the number.

if(rem == el) occ++; // If "rem" is same as "el" then increament "occ".

i = i / 10; //By this we are extracting rem from number i.

}

printf("No of Occurrence of %d element is : %d", el, occ); // Printing the number of occurences

</pre>

that's it.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

let the number to be searched for be stored in key

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

{

if(arr[i]==key)

{

printf("found");

break;

}

}

if(i==arraylength)

printf("not found");

where arr is the array and arraylength is its length

i is a loop control variable

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find the occurrence of an element in a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is atomic number and where can you find an element's atomic number?

The atomic number is the number of protons in the element. For example calcium has 20 protons, so that means it has an atomic number of 20. You can find the element's number on the periodic table; its usually the number on top of the element's symbol


What is an atomic number and where can you find one listed?

the atomic number is the number of protons of an element. The atomic number specifically identifies an element. You can find it on the Periodic Table of Elements.


How to find the total electron in element?

To find the total number of electrons in an element, first you need to look up the element's atomic number. That number tells you how many protons are in the element. Then, look up the net charge of the element. The number of protons subtracted by the elements net charge will give you the number of its electrons.


How do you find the number of nucleons?

To find the number of neutrons in an atom, first find the atomic weight of the element and round that number to the nearest whole number. Then, find the atomic number of the element. Subtract that number from the atomic weight and the number of neutrons will be found.


What is the atomic number of the element radon?

We can find radon as a non metal element. Atomic number of it is 86.


What is the atomic number of atoms?

how do you find the atomic number for an element?


How many protons are in an atom of a pure element?

Each chemical element has a specific number of protons; the number of protons is equal to atomic number of the element.


How do you find the number of protons electrons of an element?

The atomic number of the element is the number of protons, therefore there has to be the same amount of electrons to protons.


What element ha an atomic number of 127.6?

We can find tellurium as a non metal element. Atomic number of it is 52.


How do you find out mass number of an element?

Mass number = Number of Protons + Number of Neutrons


What does an element atomic number equal?

The number of protrons of whichever element you choose. Each element has an exact number of protrons.


Where can you find the atomic number of tin?

We can find tin as a metal element. Atomic number of it is 50.