<u>Explanation:</u>
Hey there! you need not to panic about it ,your program didn't have Driver program i.e main program! the correct & working code is given below:
// C++ program to count even digits in a given number .
#include <iostream>
using namespace std;
// Function to count digits
int countEven(int n)
{
int even_count = 0;
while (n > 0)
{
int rem = n % 10;
if (rem % 2 == 0)
even_count++;
n = n / 10;
}
cout << "Even count : "
<< even_count;
if (even_count % 2 == 0 )
return 1;
else
return 0;
}
// Driver Code
int main()
{
int n;
std::cin >>n;
int t = countEven(n);
return 0;
}
5 or 7 I believe Good luck!
Answer:
for count in range(12,15)
Explanation:
This is a 'For' loop in python programming language and it take two or three arguments, the include: start, stop, step)
from the options given we only have two arguments (start, stop)
from my answer, the loop will begin from 12 and ends at (n-1) that's why it prints out 12, 13, and 14 only.
Answer:
value=int(input("Enter the number up-to the user wants the Fibonacci series: "))
a=0
b=1
c=1
for x in range(value):
print(c,end=" ")
c=a+b
a=b
b=c
Output :
- If the user input 5, then the output is "1 1 2 3 5".
- If the user input 10, then the output is "1 1 2 3 5 8 13 21 34 55".
Explanation:
- The above defined a python program which is used for the Fibonacci series.
- The first line of the program is used to instruct the user and take the input from the user.
- Then the for loop executes up-to that range value.
- Then in the for-loop, the two variable needs to store the current value and previous value which is used to give the series after addition.