# C Exercises: Test two integers are multiply or not

## C Basic Declarations and Expressions: Exercise-103 with Solution

Write a C program that takes two integers and tests whether they are multiplied or not.

In science, a multiple is the product of any quantity and an integer. In other words, for the quantities a and b, we say that b is a multiple of a if b = na for some integer n, which is called the multiplier. If a is not zero, this is equivalent to saying that b/a is an integer.

**Sample Solution:**

**C Code:**

```
#include <stdio.h>
int main () {
// Declare unsigned short integer variables x, y, and multi
unsigned short int x, y, multi;
// Prompt the user to input two integers
printf("Input two integers: \n");
// Read the input values for x and y
scanf("%hd %hd", &x, &y);
// Check if x is greater than y
if (x > y){
// Calculate the remainder when x is divided by y
multi = x % y;
// Check if the remainder is zero
if ( multi == 0){
printf("Multiplies\n");
}
else{
printf("Not Multiplies\n");
}
}
else{
// Calculate the remainder when y is divided by x
multi = y % x;
// Check if the remainder is zero
if (multi == 0){
printf("Multiplies\n");
}
else{
printf("Not Multiplies\n");
}
}
}
```

Sample Output:

Input two integers: 3 9 Multiplies

**Flowchart:**

**C programming Code Editor:**

**Previous:** Write a C program that reads three integers and sort the numbers in ascending order. Print the original numbers and sorted numbers.

**Next:** Write a C program that read the item’s price and create new item price and increased price of that item according to the item price table.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join