bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 11, Problem 3E

Explanation of Solution

Complete program:

//Definition of class Fibonacci

public class Fibonacci

{

    //Definition of class main

    public static void main(String[] args)

    {

        long result = OddCount(897621);

System.out.println("Number of odd digits: " + result);

    }

    //Definition of method "OddCount()"

    public static long OddCount(long num)

    {

        //Declare required variable

        long resValue;

        //Check whether the "num" equals to "0"

        if (num == 0)

            // Assign "resValue" to "0"

            resValue = 0;

        else

        {

            //Determine the mod for the given number

            long d = num % 10;

            //Check whether the value is less than 0

            if (d < 0)

                //Multiply the value with "-1"

           ...

Blurred answer
Students have asked these similar questions
No AI solutions please
No AI solutions please
No AI solutions please

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Introduction to Big O Notation and Time Complexity (Data Structures & Algorithms #7); Author: CS Dojo;https://www.youtube.com/watch?v=D6xkbGLQesk;License: Standard YouTube License, CC-BY