Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Factorial.java
Original file line number Diff line number Diff line change
@@ -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));
}
Expand Down
20 changes: 20 additions & 0 deletions armstrong.py
Original file line number Diff line number Diff line change
@@ -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")
16 changes: 16 additions & 0 deletions digit.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>
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;
}
22 changes: 22 additions & 0 deletions palindrome.java
Original file line number Diff line number Diff line change
@@ -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");
}
}