Karthikeya - CS Journal
Karthikeya - CS Journal
JOURNAL
Name of Candidate: Kailasapu Karthikeya
Roll No. of Candidate: 15
Class: XIA CBSE
Certificate
1
Internal Examiner:- Signature:-
Date:
INDEX
Sequential Construct
WAP to read 3 numbers from the user and print the sum and average.
1.
Sequential Construct
WAP to read 2 numbers from user and print maximum number
2.
2
WAP to read 3 numbers from the user and print the maximum number (nested
if structure).
3
13. Program to check if user entered number is prime, else print number of
factors.
14 Program to print multiplication table of user entered number.
16. program to print the following for the user entered number
1. Sum of digits (while loop)
2. Reverse of a number (Palindrome number (while loop))
18. Display the following pyramids with the help of nested for loops.
* 1 1
* * 1 2 2 3
*. *. * 1. 2. 3 4. 5. 6
*. *. *. * 1. 2. 3. 4 7. 8. 9. 10
*. *. *. * *
*. *. * * *
* * *. *. *
* *. *. *. *
20. Write a program to input the values of x and n and print the following series.
(Use pow() )
4
5
Programs
Topics:- Functions
print("--------------")
average=(a+b+c)/3
6
Output:-
7
Topics:- Functions
print("--------------")
8
Output
9
Topics:- Functions
print("--------------")
10
Output
11
Topics:- Functions
structure)
print("--------------")
#Nested Structure
if a>b: #mainif
if a>c: #nested if
g=a
else:
g=c
else:
if b>c:
g=b
12
else:
g=c
print("Greater is = ",g)
Output
13
Topics:- Functions
print("--------------")
else:
print(c)
14
Output
15
Topics:- Functions
print("--------------")
print("-------Calculator-------")
print("Select operation.")
16
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
while True:
if choice == '1':
print(num1, "+", num2, "=", add(num1, num2))
17
Output
18
Topics:- Functions
print("--------------")
if bmi <=18.5:
print("You are Underweight")
elif bmi >=18.5 <=24.9:
print("You are Normal")
elif bmi >=25 <=29.9:
19
print("You are OverWeight")
elif bmi >=30:
print("You are Obese")
else:
print("You are Severely Obese")
Output
20
Topics:- Functions
print("--------------")
import math
print(math.sqrt(81))
print(math.ceil(87.9))
print(math.ceil(81.8))
print(math.floor(82.4))
print(math.floor(81.9))
print(math.pow(6,10))
print(math.fabs(81))
print(math.fabs(-81))
print(math.sin(81))
print(math.cos(81))
print(math.tan(81))
print(math.pi)
21
Output
22
Topics:- Functions
Source Code
23
Output
24
Topics:- Functions
print("--------------")
# Statistical module
# mean, median, mode
print("Statictical Module")
import statistics
A1=[11,22,33,33,44,55,77]
T1=[12,22,84,84,51,69,99]
25
# To get mode in a given list
print("original list",A1)
print("mode of list",statistics.mode(A1))
print("original tuple",T1)
print("mode of tuple",statistics.mode(T1))
Output
26
Topics:- Functions
print("--------------")
27
Output
28
Topics:- Functions
print("--------------")
# two terms
n1, n2 = 0, 1
count=0
if nterms <= 0:
print("Please enter a positive integer")
elif nterms == 1:
print("Fibonacci sequence upto",nterms,"is :-")
print(n1)
else:
print("Fibonacci sequence upto",nterms,"is :-")
while count < nterms:
print(n1)
nth = n1 + n2
#final values
n1 = n2
29
n2 = nth
count += 1
Output
30
Topics:- Functions
Program 13:- Program to check if user entered number is prime, else print number of
factors.
print("--------------")
break
else:
31
Output
32
Topics:- Functions
print("--------------")
33
Output
34
Topics:- Functions
print("--------------")
import random
L1 = [1, 2, 3, 4, 5, 6]
print ("random number from dice is:", random.choice (L1))
Output
35
Topics:- Functions
print("--------------")
print("---------------------------")
temp=n
rev=0
36
while n>0:
d = n%10
a = a+d
rev = rev *10 +d
n = n//10
if temp == rev:
print (temp, "is palidrome number")
else:
print (temp, "is not palindrome number")
print (a)
Output
37
Topics:- Functions
print("--------------")
'''
for i in range(1,11):
print(i)
else:
print("Loop Successful")
print("out of loop")
'''
for c in range(1,11):
if c==3:
continue
if c==7:
break
print(c)
else:
print("successful loop")
print("out of loop")
38
Output
39
Topics:- Functions
Program 18:- Display following pyramids with help of nested for loop
* 1 1
* * 1 2 2 3
*. *. * 1. 2. 3 4. 5. 6
*. *. *. * 1. 2. 3. 4 7. 8. 9. 10
print("--------------")
40
rows = int(input ("Enter number of rows: "))
number = 1
Output
41
Topics:- Functions
Program 19:- Display following pyramids with help of nested ‘while loop’
*. *. *. * *
*. *. * * *
* * *. *. *
* *. *. *. *
print("--------------")
print("\n")
k = 2*rows - 2
42
for i in range (0, rows):
# decrement
k=k-2
43
Output
44
Topics:- Functions
Program 20:- Write a program to input value of x and n and print the following series. (Use
pow() )
print("--------------")
for a in range (n + 1) :
if a%2==0:
s += x**a
else:
s -= x**a
print ("Sum of series", s)
45
print("-------------------------------")
for a in range (n + 1) :
if a%2==0:
s += x**a
else:
s -= x**a
print ("Sum of series", s)
print("-------------------------------")
for a in range (n + 1) :
if a%2==0:
s += (x**a)/n
else:
s -= (x**a)/n
print("-------------------------------")
46
x = float (input ("Enter value of x :"))
n = int (input ("Enter value of n :"))
s=0
a=1
fact=1
for a in range (1,n + 1) :
fact=fact*a
if a%2==0:
s += (x**a)/fact
else:
s -= (x**a)/fact
print ("Sum of series", s)
47
Output
48
THE END
49