In: Computer Science
Write a program that asks the user to type in two integer values. Test these two numbers to determine whether the first is evenly divisible by the second and then display the appropriate message to the terminal.
Objective C
Answer:
Code:
#include<stdio.h>
int main()
{
int num1, num2; //declare variable to store
numbers
printf("Enter first integer number: ");
scanf("%d", &num1); //Accept first number
printf("Enter second integer number: ");
scanf("%d", &num2); //Accept second number
if(((num1/num2) % 2) == 0) //check if the division is
even or odd
printf("\nFirst number is evenly
divisible by second number.\n"); //Display Message
else
printf("\nFirst number is NOT
evenly divisible by second number.\n"); //Display Message
return 0;
}
Screenshot: