Skip to content

Commit 81f00fe

Browse files
committed
MODIFICATIONS
1 parent f5ff0ae commit 81f00fe

File tree

4 files changed

+49
-55
lines changed

4 files changed

+49
-55
lines changed

SpecialBigInteger.java renamed to BigIntegerProgram.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java.math.BigInteger;
2-
public class specialBigInteger {
2+
public class BigIntegerProgram {
33
public static void main(String[] args) {
44
// TODO Auto-generated method stub
55
BigInteger A = new BigInteger("1"); // your number to be checked

Condominium.cpp

Lines changed: 0 additions & 43 deletions
This file was deleted.

Function_Overloading.java

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
1+
import java.util.Scanner;
12

23
public class Function_Overloading {
34

45
public static void num_cal(int num, char ch){
56
if (ch=='s')
6-
System.out.println(num*num);
7+
System.out.println("Square of "+num+" is: "+(num*num));
78
else
8-
System.out.println(num*num*num);
9+
System.out.println("Cube of "+num+" is: "+(num*num*num));
910
}
1011
public static void num_cal(int a,int b, char ch){
1112
if (ch=='p')
12-
System.out.println(a*b);
13+
System.out.println("Product of "+a+" and "+b+" is " +(a*b));
1314
else
14-
System.out.println(a+b);
15+
System.out.println("Sum of "+a+" and "+b+" is " +(a+b));
1516
}
1617
public static void num_cal(char a, char b){
1718
if (a==b)
18-
System.out.println("Same Characters");
19+
System.out.println(a+" and "+b+" are "+"same Characters");
1920
else
20-
System.out.println("Different Characters");
21+
System.out.println(a+" and "+b+" are "+"different Characters");
2122
}
2223

2324
public static void main (String[]args) {
24-
25-
num_cal(4,'s');
26-
num_cal(5,6,'p');
27-
num_cal('c','c');
28-
25+
Scanner sc = new Scanner (System.in);
26+
27+
System.out.println("Enter a number ");
28+
int num = sc.nextInt();
29+
System.out.println("Enter 's' for square root of the number or press any key for cube of the number ");
30+
char ch1 = sc.next().charAt(0);
31+
System.out.println("Enter 'a' ");
32+
int a = sc.nextInt();
33+
System.out.println("Enter 'b' ");
34+
int b = sc.nextInt();
35+
System.out.println("Enter 'p' for product of the numbers or press any key for sum of the numbers ");
36+
char ch2 = sc.next().charAt(0);
37+
System.out.println("Enter two characters");
38+
char char1 = sc.next().charAt(0);
39+
char char2 = sc.next().charAt(0);
40+
num_cal(num,ch1);
41+
num_cal(a,b,ch2);
42+
num_cal(char1,char2);
43+
sc.close();
2944
}
3045
}

NormOfNUmber.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java.util.Scanner;
2+
public class NormOfNUmber {
3+
// square root of sum of squares of digits of a number
4+
public static int NormCalc(int num){
5+
int d=0,sum=0,norm;
6+
while (num!=0){
7+
d=num%10;
8+
sum+=d*d;
9+
num/=10;
10+
}
11+
norm=(int)Math.sqrt(sum);
12+
return norm;
13+
}
14+
15+
public static void main (String[]args) {
16+
Scanner sc = new Scanner(System.in);
17+
int num=sc.nextInt();
18+
System.out.println( NormCalc(num));
19+
sc.close();
20+
}
21+
}
22+

0 commit comments

Comments
 (0)