Best Answer

if ( x % 6 == 0 ){ printf( "%d is divisible by 6", x ); } else { printf( "%d is not divisible by 6", x ); }

User Avatar

Wiki User

โˆ™ 2011-08-03 21:50:09
This answer is:
User Avatar
Study guides


20 cards

A polynomial of degree zero is a constant term

The grouping method of factoring can still be used when only some of the terms share a common factor A True B False

The sum or difference of p and q is the of the x-term in the trinomial

A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

See all cards
1763 Reviews

Add your answer:

Earn +20 pts
Q: How do you write a program to test if a given number is divisible by 6 in C programming?
Write your answer...
Still have questions?
magnify glass
Continue Learning about Engineering

Write a program in c language to sum and average a given number?

The sum and average of a given number is just that number, so there is no need to write a program.

C program to find weather given number is even or not?

/*Title: even.cA simple C program to find if the given number is even or not.*/#include int main(){int number;/* prompt the user for a number */printf("\nNumber: ");scanf("%d" , &number);/*Check if the number is even or not. A number is even if it is divisible by 2.The remainder is zero.*/if(number % 2 == 0)printf("The number %d is even\n" , number);elseprintf("The number %d is odd\n" , number);return 0;}

What does object oriented program has to with data and code?

Object Oriented Programming has everything to do with a programming language. Programming Languages are classified into: 1.Object Oriented Programming 2.Process Oriented Programming In Object Oriented Programming, more stress is given to data rather than Algorithm of the program giving the programmer his fre will to do anything without violating few rules of programming(like grammatical errors). Object Oriented Programming breaks the program into small objects so as to make it easily changable & to prevent free flow of data and also to create a logical insulation between the program and outside world.

Write a c program To count number of words in a given string?

Write a C program to count the number of characters in a given string with and without using srtlen() function

What is imperative programming language?

Computer programming is either imperative or declarative. Declarative programming states what a program is to do, but not how to do it (the how being determined by the language implementation). Conversely, an imperative programming language states how to perform a given task, usually as sequence of functions or sub-procedures using any combination of procedural, structured and object oriented programming.

Related questions

Write a program in c to check whether a number is divisible by five?

void main(){ int i,j; scanf("%d",&i); if((i%5)==0) printf("the given number is divisible by 5); }

Is 52563744 divisible by 24?

Sol: 24 = 3 x 8, where 3 and 8 are co-primes. The sum of the digits in the given number is 36, which is divisible by 3. So, the given number is divisible by 3. The number formed by the last 3 digits of the given number is 744, which is divisible by 8. So, the given number is divisible by 8. Thus, the given number is divisible by both 3 and 8, where 3 and 8 are co-primes. So, it is divisible by 3 x 8, i.e., 24.

What do we call a number which is divisible by a given number?

a multiple

Why do computers need programming?

With out programming a computer will do nothing. The program tells the computer what to do when various command are given.

What is a quick way to determine if 3 is a factor of a number?

If the sum of the digits of a given number is divisible by three, the number is divisible by three.

What is the smallest composite number that is not divisible by 235 or 7?

4 is the smallest composite number and it is not divisible by the two given numbers.

Does a prime number always go an equal number of times?

No. A given number need not even be divisible by a given prime.

What are numbers evenly divisible by a given number?

Those are multiples.

How do you divisble by 4?

It is not possible to answer this question. There is no such word as divisble and I am assuming that it is meant to be divisible. However, you cannot "divisible by 4". Divisible by 4 is a property that some numbers have and others don't and you can check if a given number is divisible by 4. Alternatively, you can divide by a given number by 4.

How do you write a c program to calculate the SUM and COUNT of Primes from a given range of numbers?

To get complete tutorials of "c programming" prime number

What is the least number that must be given to to make 451603 divisible by 9?


What number is divisible by 2 3 4?

The LCM of the given numbers is 12

People also asked