Computer Science, asked by shreeparnagupta3, 7 hours ago

in c++ wap to enter a number and print the frequency of even numbers it has using while loop programs​

Answers

Answered by devarchanc
1

C++

Explanation:

#include <stdio.h>

int main()

{

int m, n, count=0;printf("Enter any number: ");

scanf("%d", &m);

while(m>0)

{

n= num%10;

m=m/10;

if(n%2==0)

{

    count++;

}

 }

   printf("The frequency of even digits is %d ",count);

}

Note:

  • n= num%10 is used to find out the last digit of entered number m and stored it in variable n.
  • m= m/10 is used to remove the last digit of entered number m and update the value of m.

Similar questions