Algorithm Analysis
A number is divisible by if the remainder of the division of by equals 0. To solve the problem, let's use a conditional statement.
Algorithm Implementation
Read the input data.
scanf("%d %d",&a,&b);
Check if is divisible by . Depending on divisibility, output the answer.
if (a % b != 0) printf("%d %d\n",a/b,a%b); else printf("Divisible\n");
Java Implementation
import java.util.*; public class Main { public static void main(String[] args) { Scanner con = new Scanner(System.in); int a = con.nextInt(); int b = con.nextInt(); if (a % b != 0) System.out.print(a/b + " " + a%b); else System.out.println("Divisible"); con.close(); } }
Python Implementation
a, b = map(int,input().split()) if a % b != 0: print(a // b, a % b); else: print("Divisible");