Programming Exercises

Write a component that calculates the GCD (Greatest Common Divisor) of two hardcoded numbers and displays it.

Hard

Problem Statement

Write a component that calculates the GCD (Greatest Common Divisor) of two hardcoded numbers and displays it.

Sample Input

Numbers: 56 and 98

Sample Output

GCD: 14

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import React from "react"; const CalculateGCD = () => { return ( <div> {/* Display the GCD */} </div> ); }; export default CalculateGCD;
Log in or sign up to run or submit your code.Log inSign up
Input
Numbers: 56 and 98
Expected Output
GCD: 14