https://meet.google.com/bjp-tnpc-zee
Tuesday, January 21, 2025
Wednesday, January 1, 2025
python Sample Experiments(ECE/IVsem)
1. Write a program to find the largest element among three Numbers.
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
num3 = int(input("Enter the third number: "))
if num1 >= num2 and num1 >= num3:
largest = num1
elif num2 >= num1 and num2 >= num3:
largest = num2
else:
largest = num3
print("The largest number is:",largest)
2.Write a program to add and multiply complex numbers
print("Enter the first complex number (in the form a+bj):")
complex1 = complex(input())
print("Enter the second complex number (in the form a+bj):")
complex2 = complex(input())
sum_result = complex1 + complex2
product_result = complex1 * complex2
print("The sum of ",complex1," and ",complex2,"is: ",sum_result)
print("The product of ",complex1," and ",complex2," is: ",product_result)
3.Python program to calculate the factorial of a given number
num = int(input("Enter a non-negative integer: "))
if num < 0:
print("Factorial is not defined for negative numbers.")
else:
factorial = 1
for i in range(1, num + 1):
factorial *= i
print("The factorial of ",num," is: "factorial)
4.Python program to reverse a given number:
num = int(input("Enter a number: "))
reversed_num = 0
while num > 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num = num // 10
print("The reversed number is: ",reversed_num)
5.Python program to generate Fibonacci numbers up to a given number
limit = int(input("Enter a positive number: "))
a, b = 0, 1
print("Fibonacci numbers up to", limit, "are:")
while a <= limit:
print(a, end=" ")
a, b = b, a + b
https://meet.google.com/bjp-tnpc-zee
-
Design LALR Bottom up Parser. <parser.l> %{ #include<stdio.h> #include "y.tab.h" %} %% [0-9]+ {yylval...
-
task1: until single digit occurred sum of all digits in the given number task2: non reputed digits count in the given number task3: differen...