0% found this document useful (0 votes)
62 views30 pages

Ip Projecct

The document contains a practical file for an IP student named Ommar Patel. It includes 34 programs with descriptions of the problem to be solved and the expected output for each program. The programs cover a range of concepts including input/output, arithmetic operations, loops, conditional statements, functions and patterns. Example programs include calculating the sum of three numbers, finding the average temperature over a week, and printing patterns using loops and conditional logic.

Uploaded by

techommar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views30 pages

Ip Projecct

The document contains a practical file for an IP student named Ommar Patel. It includes 34 programs with descriptions of the problem to be solved and the expected output for each program. The programs cover a range of concepts including input/output, arithmetic operations, loops, conditional statements, functions and patterns. Example programs include calculating the sum of three numbers, finding the average temperature over a week, and printing patterns using loops and conditional logic.

Uploaded by

techommar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

IP PRACTICAL FILE

Name: Ommar Patel


Class: XI-C(A)
Roll number: CA3
Prg.
No.
Program

1. Program to obtain 3 numbers and print their sum

2. Program to obtain length and breadth of a rectangle and


print its area.
3. Program to calculate BMI of a person.

4. Program to convert tonnes into kilos and quintals.

5. Program to calculate area and volume of sphere with


radius 7.5 metres.
6. Program to repeat the string “GOOD MORNING” n times.
Here n is an integer input by the user.
7. Program to obtain rate of interest, principle and time from
user and compute simple interest.
8. Program to obtain temperature of 7 days and display the
average temperature.
9. Program to obtain x,y,z from the user and find the value of
4x^4+3y^3+9z+6pi
10. Program to convert time in seconds to time in minutes.

11. Program to input a string and print it equal to the number


of times of its length
12. Program to input 3 numbers and print the largest of them.

13. Program to find sum of all input numbers and sum of all
non-duplicate numbers.
14. Program to find multiples of a number out of 5 numbers.

15. Program to input 2 numbers and one arithmetic operator


and compute the result.
16. Program to find if a character is uppercase, lowercase,
number, or special character.
Program to find result of a quadratic equation.
18. Program to print the sum of first 7 natural numbers.

19. Program to print a pattern.

20. Program to print a pattern.

21. Program to find sum of square of first 100 natural


numbers.
22. Program to find max and min out of 5 numbers.

23. Program to print a pattern.

24. Program to print a pattern.

25. Program to print a pattern.

26. Program to print all numbers divisible by 5 and 7 between


500 and 700.
27. Program to print a pattern.

28. Program to print a pattern.

29. Program to print a pattern.

30. Program to display every number between 1 to n divisible


by m and show that whether n is odd or even

31. Program to print a pattern.

32. Program to print a pattern.

33. SQL Based

34. SQL Based


Program 1: Program to obtain 3 numbers and print their sum.
num1=int(input("Enter Number 1 : "))
num2=int(input("Enter Number 2 : "))
num3=int(input("Enter Number 3 : "))
sum=num1+num2+num3
print("Three Numbers are : ",num1,num2,num3)
print("Sum is : ",sum)

Output of Program 1:
Program 2: Program to obtain length and breadth of a rectangle and print its
area.
length=float(input("Enter the length of rectangle : "))
breadth=float(input("Enter the breadth of rectangle : "))
area=length*breadth
print("Rectangle specifications ")
print("Length : ",length," Breadth : ",breadth," Area : ",area)
Output of Program 2:

Program 3: Program to calculate BMI of a person.


height = float(input("Enter your height in cm: "))
weight = float(input("Enter your weight in kg: "))
BMI = weight / (height/100)**2
print(f"You BMI is {BMI}")

Output of Program 3:

Program 4: Program to convert tonnes into kilos and quintals.


tonnes=float(input("Enter weight in tonnes: "))
quintals=tonnes*10
kilograms=quintals*100
print("Tonnes: ",tonnes)
print("Quintals: ",quintals)
print("Kilograms: ",kilograms)

Output of Program 4:
Program 5: Program to calculate area and volume of sphere with radius 7.5
metres.
import math
r=7.5
area=[Link]*r*r
volume=4*[Link]*r*r*r
print("Radius of sphere: ",r)
print("Area of sphere: ",area, " metre squares")
print("Volumer of sphere: ",volume," metre cube")

Output of Program 5:

Program 6: Program to repeat the string “GOOD MORNING” n times. Here n


is an integer input by the user.
n=int(input("How many times? "))
print("GOOD MORNING "*n)

Output of Program 6:

Program 7: Program to obtain rate of interest, principle and time from user and
compute simple interest.

p = float(input("Enter principal amount : "))


n = float(input("Enter Number of years : "))
r = float(input("Enter Rate of interest : "))
si=(p*n*r)/100
print("Simple Interest : ",si)

Output of Program 7:
Program 8: Program to obtain temperature of 7 days and display the average
temperature.
d1 = float(input("Enter Sunday Temperature: "))
d2 = float(input("Enter Monday Temperature: "))
d3 = float(input("Enter Tuesday Temperature: "))
d4 = float(input("Enter Wednesday Temperature: "))
d5 = float(input("Enter Thursday Temperature: "))
d6 = float(input("Enter Friday Temperature: "))
d7 = float(input("Enter Saturday Temperature: "))

avg = (d1 + d2 + d3 + d4 + d5 + d6 + d7) / 7

print("Average Temperature =", avg)


Output of Program 8:
Program 9: program to obtain x,y,z from the user and find the value of
4x^4+3y^3+9z+6pi
import math
x=int(input("enter value of x "))
y=int(input("enter value of y "))
z=int(input("enter value of z "))
a=4*[Link](x,4)+3*[Link](y,3)+9*z+6*[Link]
print("The answer of the equation is: ", a)

Output of Program 9:
Program 10: Program to convert time in seconds to time in minutes.
t=int(input("enter time in seconds "))
min=t//60
seconds=t%60
print(t,"seconds in minutes is equal to ", min, "mins and " , seconds, "seconds")
Output of Program 10:

Program 11: Program to input a string and print it equal to the number of times
of its length
word=input("enter any word ")
length=len(word)
result=word*length
print(result)
Output of Program 11:

Program 12: Program to input 3 numbers and print the largest of them.
a=int(input("enter any number "))
b=int(input("enter any number "))
c=int(input("enter any number "))
if a>b and a>c:
print(a, "is greatest")
else:
print()
if b>a and b>c:
print(b, "is greatest")
else:
print()
if c>a and c>b:
print(c, "is greatest")
else:
print()
Output of Program 12:

Program 13: Program to find sum of all input numbers and sum of all non-
duplicate numbers.
a=int(input("enter any number "))
b=int(input("enter any number "))
c=int(input("enter any number "))
sum1=a+b+c
print("sum of all numbers is " , sum1)
sum2=0
if a!=b and a!=c:
sum2=sum2+a
if b!=a and b!=c:
sum2=sum2+b
if c!=a and c!=b:
sum2=sum2+c
print("sum of all non duplicate numbers is ", sum2)
Output of Program 13:

Program 14: Program to find multiples of a number out of 5 numbers.


a=int(input("enter any number "))
b=int(input("enter any number "))
c=int(input("enter any number "))
d=int(input("enter any number "))
e=int(input("enter any number "))
divisor=int(input("enter any number "))
count=0
if a%divisor==0:
count=count+1
print(a, "is multiple of " , divisor)
if b%divisor==0:
count=count+1
print(b, "is multiple of " , divisor)
if c%divisor==0:
count=count+1
print(c, "is multiple of " , divisor)
if d%divisor==0:
count=count+1
print(d, "is multiple of " , divisor)
if e%divisor==0:
count=count+1
print(e, "is multiple of " , divisor)
print(count, "multiples of ", divisor, "found")

Output of Program 14:


Program 15: Program to input 2 numbers and one arithmetic operator and
compute the result.
a=int(input("enter any number "))
b=int(input("enter any number "))
operator=input("enter operator[+,-,/,*,//,%]")
if operator == '+':
c=a+b
elif operator == '-':
c=a-b
elif operator == '/':
c=a/b
elif operator == '*':
c=a*b
elif operator == '//':
c=a//b
elif operator == '%':
c=a%b
else:
print("invalid operation")
print(a,operator,b,"=", c)
Output of Program 15:

Program 16: Program to find if a character is uppercase, lowercase, number, or


special character.
ch=input("enter any single character ")
if ch>='A' and ch<='Z':
print("you have enter uppercase character")
elif ch>='a' and ch<='z':
print("you have entered lowercase charater")
elif ch>='0' and ch<='9':
print("you have entered a number")
else:
print("you have enetered a special character")

Output of Program 16:

Program 17: Program to find result of a quadratic equation.


import math
print("for quadratic equation ax^2+bx+c, enter coefficients below")
a=int(input("enter any number "))
b=int(input("enter any number "))
c=int(input("enter any number "))
if a==0:
print(a, "cannot be zero")
else:
d=b*b-4*a*c
if d<0:
print("roots of quadratic equation ", a, "x^2+",b,"x+", c, "are complex and
imaginary")
elif d==0:
roots =-b/(2*a)
print("roots of quadratic equation ", a, "x^2+",b,"x+", c, "are real and equal
and they are: ",roots)
elif d>0:
root1=-b+[Link](d)/(2*a)
root2=-[Link](d)/(2*a)
print("roots of quadratic equation ", a, "x^2+",b,"x+", c, "are real and
unequal and they are: ", root1," ",root2)
else:
print()

Output of Program 17:

Program 18: Program to print the sum of first 7 natural numbers.


sum=0
for i in range (1,8):
sum=sum+i
print("sum of first 7 natural numbers are ", sum)
Output of Program 18:

Program 19: Program to print a pattern.


for i in range(1,6):
for j in range (1,i):
print("*", end = '')
print()
Output of Program 19:

Program 20: Program to print a pattern.


for outer in range (5,10,4):
for inner in range(1,outer,2):
print(outer,inner)
Output of Program 20:
Program 21: Program to find sum of square of first 100 natural numbers.
sum=0
for i in range (1,101):
sum=sum+(i*i)
print(sum)
Output of Program 21:

Program 22: Program to find max and min out of 5 numbers.


n=int(input("enter a number "))
min,max=n,n
for i in range (4):
n=int(input("enter a number "))
if max<n:
max=n
if min>n:
min=n
print("maximum number is ", max)
print("minimum number is ", min)
Output:

Program 23: Program to print a pattern.


n=1
for a in range(5):
print(n)
n=n*10+1
Output:

Program 24: Program to print a pattern.


for i in range(4):
for j in range(4,i,-1):
print(j, end = '')
else:
print()
Output:

Program 25: Program to print a pattern.


print("even number from the sequence [0,1,1,2,3,4,3,5,6,4,8,7,9] are ")
for a in [0,1,1,2,3,4,3,5,6,4,8,7,9]:
if a%2==0:
print(a, end = ',')
print()
Output:

Program 26: Program to print all numbers divisible by 5 and 7 between 500
and 700.
for i in range(500,701):
if i%5==0 and i%7==0:
print(i, "is divisible by 5 as well as 7")
Output:
Program 27: Program to print a pattern.
st=""
for x in "whoa":
st=st+x
print(st)
Output:

Program 28: Program to print a pattern.


rows=5
for num in range(1,rows+1):
for i in range(num):
print(num, end = "")
print()
Output:

Program 29: Program to print a pattern.


rows=5
for m in range(0,rows):
for n in range(0,m+1):
print("*", end = "")
print()
Output:

Program 30: Program to display every number between 1 to n divisible by m


and show that whether n is odd or even.
n=int(input("enter last limit "))
m=int(input("enter divisor "))
for i in range(1,n+1):
if i%m==0:
if i%2==0:
print(i, "is divisible by" ,m, "and is even")
if i%2!=0:
print(i, "is divisible by" ,m, "and is odd")
Output:

Program 31: Program to print a pattern.


for i in range(6) :
for j in range(20) :
print('*', end = '')
print()
Output:
Program 32: Program to print a pattern.
import math
n = int(input("Enter an integer: "))
for i in range(1, n + 1) :
if i == 1:
print("1 = 1")
else :
print(i, "=", end=' ')
c=0
for j in range(1, i + 1) :
if i % j == 0:
c += 1
if c == 2:
print(i, "(prime)", end = '')
print()
else :
t=i
while t % 2 == 0 :
print("2", end='x')
t = t // 2
k=3
x = [Link]([Link](t)) + 1
while k <= x :
while (t % k == 0) :
print(k, end='x')
t = t // k
k += 2
if t > 2 :
print(t, end='x')

print()
Output:
SQL Based:
Program 33:
a) Retrieve movies information without mentioning their column names. (b)
List business done by the movies showing only MovielD, MovieName and
Business

Cost

1) List the different categories of movies. (4) Find the net profit of each movie
showing its ID. Name and Net Profit

(Hint. Net Profit Business Cost-Production Cost)


Make sure that the new column name is labelled as NetProfit. Is this column
now a part of the MOVIE relation. If no, then what name is coined for such
columns ? What can you say about the profit of a movie which has not yet
released? Does your query result show profit as zero? (e) List all movies with
ProductionCost greater than 80,000 and less than 1,25,000 showing ID, Name
and ProductionCost.
List all movies which fall in the category of Comedy or Action
(g) List the movies which have not been released yet.

SELECT FROM Movie;


SELECT MovieID, MovieName, BusinessCost FROM Movie; (c)
SELECT Distinct Category FROM Movie;

SELECT MovieId, MovieName, BusinessCost - ProductionCost


As 'Net Profit' FROM Movie; For unreleased movie, it will
show NULL as empty values are shown as NULL and not as
zero.

SELECT MovieID, Movie Name, ProductCost from movie


WHERE ProductCost > 80000
AND ProductionCost < 125000;

SELECT FROM Movie WHERE Category = 'Comedy' ;


SELECT FROM Movie WHERE ReleaseDate is NULL;

You might also like