R

@rohit_2p

gcd

Python
3 years ago
# Using a while loop to calculate GCD of two numbers a = int(input("Enter the first number: ")) # Get the first number from user input and convert it to integer b = int(input("Enter the second number: ")) # Get the second number from user inpu

tab.py

Python
3 years ago
x = 10 y = 20 while x <= y: print(x, '\t', y) x += 1

LAB ASSIGNMENT 1

SQL
3 years ago
CREATE TABLE staff ( Id varchar(10) PRIMARY KEY, Name varchar(255) NOT NULL, Department varchar(10) CHECK (Department IN ('SALES', 'ACCOUNT', 'HR')), Salary int CHECK (Salary > 15000), Location varchar(10) ); INSERT INTO s

LAB ASSIGNMENT 02

SQL
3 years ago
-- Create customer table CREATE TABLE customer ( cust_id varchar(10) PRIMARY KEY, f_name varchar(20), l_name varchar(20), area varchar(10), ph_no varchar(10) ); -- Insert data into customer table

prime.py

Python
3 years ago
# Program to check if a number is prime or not num = int(input("Enter the number: ")) # define a flag variable flag = False if num == 1: print(num, "is not a prime number") elif num > 1:

factorial.py

Python
3 years ago
# WAP USING FOR LOOP TO CALKCULATE FACTORIAL OF NUMBER n= int(input("Enter the no: ")) fact = 1 for i in range(1, n+1): fact = fact * i print("factorial = ", fact)

even_odd.py

Python
3 years ago
# Wap using loop to print odd even in a given m and n term m = int(input("Enter the number: ")) n = int(input("Enter the number: ")) for i in range(m, n+1): if i % 2 == 0: print(f"{i} is even") else: print(f"{i} is odd")

table.py

Python
3 years ago
table = int(input("Enter the number: ")) for i in range(1, 11): print(f"{table} * {i} = {table * i}")

first_n.py

Python
3 years ago
"""WAP using loop calculate the first n number""" n = int(input("Enter the value of n: ")) avg = 0.0 s = 0 for i in range(1,n+1): s=s+i avg=s/i print(f"The sum of first {n} natural no(s): {s}") print(f"The avg of first {n} natural no(s):

check_bonus.py

Python
3 years ago
salary = float(input("Enter the salary: ")) sex = input("Enter the sex (M/F): ") if salary < 10000: bonus = 0.07 * salary else: if sex == "M": bonus = 0.05 * salary else: bonus = 0.1 * salary

vote.py

Python
3 years ago
# checking eligibility for vote def check_eligibility(age): if age >= 18: print("You are eligible to vote.") else: years_left = 18 - age print("You are not eligible to vote. You have", years_left, "years left

tax

Python
3 years ago
# tax calculation money = int(input("Enter the amount: ")) if money == 150000: print("NO TAX") elif money in range(150001, 300000): amount = money * 0.15 print(amount)

DEPT

SQL
3 years ago
-- create a table CREATE TABLE DEPT ( DEPTMO NUMERIC(2) PRIMARY KEY, DNAME VARCHAR(20) NOT NULL, LOC VARCHAR(10) NOT NULL ); -- insert some values INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK'); INSERT INTO DEPT VALUES (20, 'RESEARCH',

employee

SQL
3 years ago
/**A RELATION database CONTAINS TWO tables employees & DEPT**/ -- create a table CREATE TABLE EMP ( EMPNO NUMERIC(4) PRIMARY KEY, ENAME VARCHAR(20) NOT NULL, JOB CHAR(10), MGR NUMERIC(4), HIREDATE DATETIME, SAL NUMERIC(9,2),

billl.py

Python
3 years ago
quantity=float(input("Enter the quantity of item sold:")) price=float(input("Enter the value of item:")) tax=float(input("Enter the tax:")) print("\n******BILLING******") print("Quantity sold=",quantity) print("Price per item=",price) print("-------

salary.py

Python
3 years ago
a=int(input("Enter your salary:")) s=str(input("Enter your sex(Male/Female):")) if(s=="Male"): print("Special salary due to diwali:Rs. ",a+(a*(5/100))) if(s=="Female"): print("Special salary due to diwali:Rs. ",a+(a*(10/100))) if(s=="Male" a

binary.py

Python
3 years ago
decimal = int(input("Enter the decimal number: ")) binary = " " q = decimal while q > 0: rem = q % 2 q = q // 2 binary = str(rem) + binary

armstrong.py

Python
3 years ago
# checkinhg its a Armstrong number or not num = int(input("Enter the digit: ")) num_str = str(num) n = len(int_str) sum = 0 for digit in num_str:

tab.py

Python
3 years ago
# printing 1 to 10 using tab on the same line i = 1 while i <= 10: print(i , end="\t") i +=1

num.py

Python
3 years ago
# print a program to print 1 to 10 i = 1 while i <= 10: print(i) i += 1