From 1baed59c1505afaeb6baf7d5b3571c56496ea982 Mon Sep 17 00:00:00 2001 From: Sahel <52469898+CoderSahel@users.noreply.github.com> Date: Tue, 5 Oct 2021 14:20:22 +0530 Subject: [PATCH 1/4] #123 solved --- palindrome.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 palindrome.java diff --git a/palindrome.java b/palindrome.java new file mode 100644 index 0000000..b8eb4d3 --- /dev/null +++ b/palindrome.java @@ -0,0 +1,22 @@ +//JAVA program to check palindrome number +public class Palindrome +{ + public static void main(String args[]) + { + + int r,sum=0,temp; + int n=454;//It is the number variable to be checked for palindrome + + temp=n; + while( n>0 ) + { + r=n%10; //getting remainder + sum=(sum*10)+r; + n=n/10; + } + if(temp==sum) + System.out.println("palindrome number "); + else + System.out.println("not palindrome"); + } +} From 332931831f9162613bf9913b5ea2453472daab24 Mon Sep 17 00:00:00 2001 From: Sahel <52469898+CoderSahel@users.noreply.github.com> Date: Tue, 5 Oct 2021 14:40:23 +0530 Subject: [PATCH 2/4] #127 solved program to find the digits of an integer --- digit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 digit.c diff --git a/digit.c b/digit.c new file mode 100644 index 0000000..8f653af --- /dev/null +++ b/digit.c @@ -0,0 +1,16 @@ +#include +int main() +{ + int n; // variable declaration + int count=0; // variable declaration + printf("Enter a number"); + scanf("%d",&n); + while(n!=0) + { + n=n/10; + count++; + } + + printf("\nThe number of digits in an integer is : %d",count); + return 0; +} From 91fa2103564f8e1738180719d28a952e3f80a33d Mon Sep 17 00:00:00 2001 From: Sahel <52469898+CoderSahel@users.noreply.github.com> Date: Tue, 5 Oct 2021 14:50:19 +0530 Subject: [PATCH 3/4] #125 cleared I created a program to check Armstrong number --- armstrong.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 armstrong.py diff --git a/armstrong.py b/armstrong.py new file mode 100644 index 0000000..a988381 --- /dev/null +++ b/armstrong.py @@ -0,0 +1,20 @@ +# Python program to check if the number is an Armstrong number or not + +# take input from the user +num = int(input("Enter a number: ")) + +# initialize sum +sum = 0 + +# find the sum of the cube of each digit +temp = num +while temp > 0: + digit = temp % 10 + sum += digit ** 3 + temp //= 10 + +# display the result +if num == sum: + print(num,"is an Armstrong number") +else: + print(num,"is not an Armstrong number") From 1c68803bfe9675a1c2cf4b17fae5d5d20b606d28 Mon Sep 17 00:00:00 2001 From: Sahel <52469898+CoderSahel@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:42:39 +0530 Subject: [PATCH 4/4] Update Factorial.java --- Factorial.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Factorial.java b/Factorial.java index d534eee..9cad321 100644 --- a/Factorial.java +++ b/Factorial.java @@ -1,8 +1,10 @@ +// Java program to find factorial of a number import java.util.Scanner; -public class Factorial{ +public class Factorial +{ public static void main(String[] args){ - Scanner sc=new Scanner(System.in); + Scanner sc = new Scanner(System.in); int n=sc.nextInt(); System.out.println(factorial(n)); }