SAME NAME IN CLASS METHOD AND CONSTRUCTOR, STATIC VARIABLE class Emp { String ename; int age; int sal; static int count=0; int empno; Emp() { } void Emp(String n, int a, int s) { count+=1; empno=count; ename=n; age=a; sal=s; } void show() { System.out.println("Emp_no: "+empno); System.out.println("Emp_name: "+ename); System.out.println("Emp_ag...
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)) '''
Comments
Post a Comment