Skip to content

Instantly share code, notes, and snippets.

@SanchitB23
Created February 10, 2020 17:06
Show Gist options
  • Save SanchitB23/05d3d2549cbd074b877478dcbf0aafb5 to your computer and use it in GitHub Desktop.
Save SanchitB23/05d3d2549cbd074b877478dcbf0aafb5 to your computer and use it in GitHub Desktop.
Go Rapid
package practice.CodingQues.UnorderedQuestions;
import java.util.Scanner;
public class GandhiNumber {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long num = scanner.nextInt();
long temp = num;
long sum = 0;
while (temp > 0) {
sum += Math.pow(temp % 10, 4);
temp /= 10;
}
if (sum == num) System.out.println("It is a Gandhi Number");
else System.out.println("It is not a Gandhi Number");
}
}
package practice.CodingQues.UnorderedQuestions;
//Write a code to find out all positive whole numbers x & y satisfying the equation x*y = 130
public class XandYRelation {
public static void main(String[] args) {
for (int i = 1; i < 131; i++) {
for (int j = 1; j < 131; j++) {
if (i * j == 130) {
System.out.println("Res: " + i + "," + j);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment