Write a program in python to calculate greatest common divisor of a number import math print("Greatest Common Divisor ") # prints 12 print("The gcd of 60 and 48 is : ", end="") print(math.gcd(60, 48)) # The gcd of 98 and 56 is : 14 # The gcd of 60 and 48 is : 12 ''' def hcf(a, b): if(b == 0): return a else: return hcf(b, a % b) a = 60 b = 48 # prints 12 print("The gcd of 60 and 48 is : ", end="") print(hcf(60, 48)) '''
JAVA STRING .REPLACE /* 5. WAP in Java to print when letters and corresponding frequency in a sentence. */ import java.util.*; class Test { public static void main(String args[]) { Scanner sc=new Scanner(System.in); String name; System.out.print("\nENTER ANY NAME: "); name=sc.nextLine(); String ns2=(name.charAt(0)+". "); String ns=""; int i=0,j=1; int sch=0; name.toLowerCase(); int len=name.length(); name.toLowerCase(); ...
Comments
Post a Comment