1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marta_Voda [28]
3 years ago
6

Some numbers are formed with closed paths. the digits 0, 4, 6 and 9 each have 1 closed path and 8 has 2. None of the other numbe

rs is formed with a closed path. Given a number determine the total number of closed paths in each of its digits combined.
Computers and Technology
1 answer:
postnew [5]3 years ago
5 0

Answer:

def cal(n):

s=0

while n>0:

r=n%10

if(r==0 or r==4 or r==6 or r==9):

s=s+1

elif r==8:

s=s+2

n=n//10

print(s)

n=int(input("enter number:"))  

print(n)

cal(n)

Explanation:

  • Create a function to calculate count of closed path .
  • Create a variable to store count of closed path .
  • While number is positive , extract last digit of n .
  • Reduce number by truncating last digit .
  • Make a function call to compute count of path.
You might be interested in
What's wrong with these codes in code HS Karel challenges(7.1.2. Racing Karel) Codes: //Below is the program that have Karel mov
Viktor [21]

Answer:

The program only runs 5 five since the for loop statement is limited to loop only five times.

Explanation:

In programming, a for-loop statement is used to repeat a collection of events a definite number of times. The number of loops is specified and compared with a variable to execute a block of code.

The for-loop statement in the code above declares and initializes a variable "i" to zero, runs the block of code, and increments by one if it is less than 5.

To make it run eight times, the value five should be changed to 8 instead.

5 0
3 years ago
What is BINARY it is making get confused
enot [183]
It is a number that is expressed in the binary numerical system
6 0
3 years ago
Problem 2 Write a method that (a) returns an int[] , (b) takes in two sorted arrays (in descending order) and (c) returns an int
Galina-37 [17]

Answer:

Following are the Program in the Java Programming Language.

//define class

public class Main

{

//define function to merge and sort array

public static int[] sort_Array(int[] a, int[] b)

{

//set integer variable and initialize values

int x = 0, y = 0, k = 0, num = 0;

int n = a.length;

int n1 = b.length;

//set integer type array

int[] ar = new int[n+n1];

//set while loop

while (x<n && y <n1)

{

num++;

num++;

//set if conditional statement

if (a[x] > b[y])

ar[k++] = a[x++];

else

ar[k++] = b[y++];

num++;

}

//set the while loop

while (x < n)

{

num++;

ar[k++] = a[x++];

}

//set the while loop

while (y < n1)

{

num++;

ar[k++] = b[y++];

}

//print the total compares done

System.out.println("Number of compares done: " + n);

//return array

return ar;

}

//define main method

public static void main(String[] args)

{

//declaration and the initialization of array

int[] a = new int[]{18,16, 15, 6, 2};

int[] b = new int[]{13, 12, 11, 7, 1};

int[] ar;

//call function

ar = sort_Array(a, b);

//print message

System.out.println("\nThe resultant array is: \n");

//set for loop to print array

for(int x=0; x<ar.length; x++)

{

System.out.print(ar[x] + " ");

}

}

}

<u>Output</u>:

Number of compares done: 5

The resultant array is:

18 16 15 13 12 11 7 6 2 1

Explanation:

Here, we define a class "Main" inside the class, define a function "sort_Array()"and pass two integer type array argument "a" and "b".

  • Set four integer type variables "x", "y", "k", and "num" and initialize them to 0.
  • Set two integer type array "n", "n1" and initialize them the length of the array then, set integer type array variable "ar".
  • Set the while loop then, set if conditional statement then, agin set while loop to sort array in descending order.
  • Then, print the number of compares and return the value of the variable "ar".

Finally, define the main method inside it, we set two integer type array variable and initialize elements in them then, set the for loop to print the sorted elements of the array.

4 0
3 years ago
Terrence smiles at his customers, helps his coworkers, and stays late when needed. What personal skill does Terrence demonstrate
Salsk061 [2.6K]
Friendliness or it shows that he follows the rules
6 0
3 years ago
Read 2 more answers
In which slot is a video card most commonly installed within a laptop?
IgorLugansk [536]

Answer:

<u>PCIe</u> is used for video card installation on Laptop.

Explanation:

Good quality applications, videos and games required graphics card for better results. These card can be installed on laptops, that required some ports.

PCI-e is a slot, that is used in laptop for video or graphic card interface. Video card or graphic card is used to enable high quality video or graphics on Laptop.

PCI- E stand for Peripheral Component Interconnect Express. It work as serial communication interface for high speed device.

7 0
3 years ago
Other questions:
  • What is special about the f and j keys on a standard keyboard?
    15·2 answers
  • To find a webpage, the user of a search engine would simply enter a word or phrase in the resource's text box. what is the term
    11·1 answer
  • What are 3 websites that talk about density of different gases, density in air, behavior of different gases of earth, convection
    13·1 answer
  • The memory unit of a computer has 256k words of 32 bits each. The computer has an instruction format with 4 fields: an opcode fi
    15·1 answer
  • How do you change colors for presentation to blue warm in power point?
    11·1 answer
  • Greg works outside. He is often found cutting grass and making the local park grounds look nice for guests.
    10·1 answer
  • Modify the sentence-generator program of Case Study so that it inputs its vocabulary from a set of text files at startup. The fi
    15·1 answer
  • Mississippi law codes state that bullying and cyberbullying are against the law. A court can decide to incur ___________________
    10·1 answer
  • 2) Please create a C program for the following: (25 points) a. Suppose the US dollar to Korean Won is 0.85 dollars to 1000 won.
    13·1 answer
  • Explain how power surges can affect computers and how this problem can be minimised or removed<br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!