From 6cdffb93968488ee6ca633c3bfa9e0550b9b04ba Mon Sep 17 00:00:00 2001 From: suhail ahmed Date: Tue, 5 Oct 2021 17:29:08 +0530 Subject: [PATCH 1/2] added celsius to fahrenhiet convertios program --- Mathematics/Celsius_to_Fahrenheit.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Mathematics/Celsius_to_Fahrenheit.c diff --git a/Mathematics/Celsius_to_Fahrenheit.c b/Mathematics/Celsius_to_Fahrenheit.c new file mode 100644 index 0000000..1e305e2 --- /dev/null +++ b/Mathematics/Celsius_to_Fahrenheit.c @@ -0,0 +1,15 @@ +//Function for conversion +float convertCelFahrenheit(float c) +{ + return ((c * 9.0 / 5.0) + 32.0); +} +int main() +{ + float celsius, fahrenheit; + printf("Enter temperature in Celsius: "); + scanf("%f", &celsius); + //called function to convert celsius to fahrenheit + fahrenheit = convertCelFahrenheit(celsius); + printf("%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit); + return 0; +} \ No newline at end of file From 1479f5813bedfc0914809e2c807ad5ce9f3a7045 Mon Sep 17 00:00:00 2001 From: suhail ahmed Date: Thu, 7 Oct 2021 01:49:48 +0530 Subject: [PATCH 2/2] added palindrome pgm in java and python --- Mathematics/Palindrome.java | 18 ++++++++++++++++++ Mathematics/palindrome.py | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Mathematics/Palindrome.java create mode 100644 Mathematics/palindrome.py diff --git a/Mathematics/Palindrome.java b/Mathematics/Palindrome.java new file mode 100644 index 0000000..a8fbbc1 --- /dev/null +++ b/Mathematics/Palindrome.java @@ -0,0 +1,18 @@ +import java.util.*; +class Palindrome +{ + public static void main(String args[]) + { + String original, reverse = ""; // Objects of String class + Scanner in = new Scanner(System.in); + System.out.println("Enter a string/number to check if it is a palindrome"); + original = in.nextLine(); + int length = original.length(); + for ( int i = length - 1; i >= 0; i-- ) + reverse = reverse + original.charAt(i); + if (original.equals(reverse)) + System.out.println("Entered number is a palindrome."); + else + System.out.println("Entered number isn't a palindrome."); + } +} \ No newline at end of file diff --git a/Mathematics/palindrome.py b/Mathematics/palindrome.py new file mode 100644 index 0000000..5f9a200 --- /dev/null +++ b/Mathematics/palindrome.py @@ -0,0 +1,11 @@ +num=int(input("Enter a number:")) +temp=num +rev=0 +while(num>0): + dig=num%10 + rev=rev*10+dig + num=num//10 +if(temp==rev): + print("The number is palindrome!") +else: + print("Not a palindrome!") \ No newline at end of file