answersLogoWhite

0


Best Answer

Here's a code snippet that solves that problem.

if((total%5==0) (total%4==0)) {

count += 1;

} else {

count += 2;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write an if-else statement that increments the value of count by 1 if the value of total is evenly divisible by four or five and increments the value of count by 2 otherwise?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How many numbers between 0-100 are divisible by 7?

Here is a list of whole numbers less than 100 which are evenly divisible by 7714212835424956637077849198


True or false If you took an if then statement and inserted a not into each clause the new statement would also be true.?

This is true in a very basic sense. But statements cannot always be flipped around this way. I don't know if you're talking about programming or logic, but in programming, say you have the statement: if count == 34 then endloop = true. There may be another statement later that turns endloop true no matter what. In logic, if the "if" statement has absolutely nothing to do with the "then" statement, then the answer to your question is false -FALSE!


Write a program that prompts the user to enter an integer and determines whether it is divisible by 5 and 6 whether it is divisible by 5 or 6 and whether it is divisible by by 5 or 6 but not both?

#! /usr/bin/env rubyn = gets.to_id = 'is not'd = 'is' if n % 7 == 0puts 'Your number ' + d + ' divisible by seven.'For more accurate answer, please define the programming/script language you plan to use..


How do you write a java program to print numbers that have number nine up to 100?

Solution 1public class Divisible {int num;int sum;public void calculate() {sum=0;System.out.println("Numbers divisible by 9:");for(num=50;num


Is brass a mixture in which the particles are evenly mixed at the level of atoms or molecules?

Brass is an alloy, which is (generally) a combination of metals in a metallic matrix. In the case of brass, we see copper and zinc in combination, and these metals come together to become evenly mixed at the atomic level. That said, is brass a mixture in which the particles are evenly mixed at the level of atoms or molecules? Yes, it is.

Related questions

Is 148 divisible by 9?

148 is not evenly divisible by 9.


Is 10032 evenly divisible by 7?

No, 10032 is not evenly divisible by 7.


What Numbers divisible by 6?

All multiples of 6 Numbers are evenly divisible by 6 if they are evenly divisible by both 2 AND 3. Even numbers are always evenly divisible by 2. Numbers are evenly divisible by 3 if the sum of all the individual digits is evenly divisible by 3. For example, the sum of the digits for the number 3627 is 18, which is evenly divisible by 3 but 3627 is an odd number so the number 3627 is not evenly divisible by 6


Is 416 divisible by 5?

Any number is divisible by any other number. However, I am guessing you are actually asking if 416 is evenly divisible by 5, and that answer would be no. A quick way to tell if any natural number is evenly divisible by 5, is to see if the last (rightmost) digit is a 5 or a 0. If it is, the answer is yes. Otherwise, the answer is no.


How can you determine if a year is a leap year?

First, you can rule out a year being a leap year if it is an odd number, like 2013. If the year is even, is it evenly divisible by 4? If it's not evenly divisible by 4, it's not a leap year. Example: 2010 If it is evenly divisible by 4, is it evenly divisible by 100? If it's not evenly divisible by 100, it is a leap year. Example: 2012 If it is evenly divisible by 100, is it evenly divisible by 400? If it's not evenly divisible by 400, it's not a leap year. Example: 2100 If it is evenly divisible by 400, it is a leap year. Example: 2000


How do you test if a year is a leap year?

To determine whether a year is a leap year, follow these steps:If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5.If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4.If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5.The year is a leap year (it has 366 days).The year is not a leap year (it has 365 days).


Is 3805 divisible by 5 and 8?

3805 is divisible by 5 evenly whereas 3805 is not divisible by 8 evenly


Is 434 divisible by 2or3or6 and 9?

434 is evenly divisible by 2.It is not evenly divisible by 3, 6, or 9.


What is 1093 evenly divisible by?

1093 is prime, so it is evenly divisible by 1093 and 1.


Is there a number evenly divisible by 10 but not evenly divisible by 5?

No as 5 is a factor of 10


Is 1859 is it a divisible by 2?

No, it is not evenly divisible.


Is 166 divisible by 3?

It is not evenly divisible.