A

@Arpita3025

Reverse a Given String:py

Python
2 years ago
def reverse_string(string): return string[::-1] # Example usage: text = input("Enter a string: ") reversed_text = reverse_string(text) print(f"The reversed string is: {reversed_text}")

Count First 'n' Odd and Even Numbers.py

Python
2 years ago
def count_odd_even_numbers(n): odd_count = n even_count = n return odd_count, even_count # Example usage: num = int(input("Enter a number 'n' to count first 'n' odd and even numbers: ")) odd, even = count_odd_even_numbers(num) print(f"C

Find ASCII Value of a Given Character: python:py

Python
2 years ago
character = input("Enter a character: ") ascii_value = ord(character) print(f"The ASCII value of {character} is {ascii_value}")

Find First 'n' Odd Numbers:py

Python
2 years ago
def find_odd_numbers(n): odd_numbers = [i for i in range(1, 2 * n, 2)] return odd_numbers # Example usage: n = int(input("Enter a number 'n' to find first 'n' odd numbers: ")) result = find_odd_numbers(n) print(f"First {n} odd numbers are:

find first"n" even numbers.py

Python
2 years ago
def find_even_numbers(n): even_numbers = [i for i in range(2, 2 * n + 1, 2)] return even_numbers # Example usage: n = int(input("Enter a number 'n' to find first 'n' even numbers: ")) result = find_even_numbers(n) print(f"First {n} even num

Calculate Area of Rectangle, Square, and Circle:.py

Python
2 years ago
import math def calculate_rectangle_area(length, width): return length * width def calculate_square_area(side): return side * side def calculate_circle_area(radius): return math.pi * radius * radius

Concatenate Two Different Strings:.py

Python
2 years ago
def concatenate_strings(str1, str2): concatenated_string = str1 + str2 return concatenated_string # Example usage: string1 = input("Enter first string: ") string2 = input("Enter second string: ") result = concatenate_strings(string1, string

greatest of 3 numbers.py

Python
2 years ago
def find_greatest(a, b, c): greatest = max(a, b, c): return greatest # Example usage: num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) num3 = float(input("Enter third number: ")) result = find_greatest(nu

greatest of 3 number.py

Python
2 years ago
def find_greatest(a, b, c): greatest = max(a, b, c) print(f"The greatest number among {a}, {b}, and {c} is: {greatest}") # Example usage: num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) num3 = float(

calculate factorial.py

Python
2 years ago
def calculate_factorial(num): factorial = 1 if num < 0: print("Factorial does not exist for negative numbers.") else: for i in range(1, num + 1): factorial *= i print(f"The factorial of {num} is {facto

calculate simple interest.py

Python
2 years ago
def calculate_simple_interest(principal, rate, time): simple_interest = (principal * rate * time) / 100 print(f"The Simple Interest is: {simple_interest}") # Example usage: principal_amount = float(input("Enter the principal amount: ")) rat

calculating compound interest .py

Python
2 years ago
def calculate_compound_interest(principal, rate, time): amount = principal * (pow((1 + rate / 100), time)) compound_interest = amount - principal print(f"The Compound Interest is: {compound_interest}") # Example usage: principal_amount

prime.py

Python
2 years ago
def check_prime(num): if num <= 1: print(f"{num} is not a prime number.") else: for i in range(2, num): if num % i == 0: print(f"{num} is not a prime number.") break else:

factorial.py

Python
2 years ago
def calculate_factorial(num): factorial = 1 if num < 0: print("Factorial does not exist for negative numbers.") else: for i in range(1, num + 1): factorial *= i print(f"The factorial of {num} is {facto

odd even.py

Python
2 years ago
def check_odd_even(num): if num % 2 == 0: print(f"{num} is an even number.") else: print(f"{num} is an odd number.") number = int(input("Enter a number: ")) check_odd_even(number)

odd even.py

Python
2 years ago
def check_odd_even(num): if num % 2 == 0: print(f"{num} is an even number.") else: print(f"{num} is an odd number.")

filehandling

C++
2 years ago
#include<iostream> #include<iomanip> #include<fstream> #include<string.h> using namespace std; class Student { public: char name[30]; int id;

Assignment 4

C++
2 years ago
#include <iostream> #include <cstring> class Person { private: char* name; char* dob; char* bloodGroup; float height; float weight;

Assignment 4.pp

C++
2 years ago
#include<iostream> #include<cstring> class Book { private: char* author; char* title; float price; char* publisher; int stockPosition;

Assignment 3 .pp

C++
2 years ago
#include<iostream> #include<cstring> class Book { private: char* author; char* title; float price; char* publisher; int stockPosition;