W.E.F. 11 Dec 2018: Faculty: Prof. Kamal Mistry
W.E.F. 11 Dec 2018: Faculty: Prof. Kamal Mistry
List of Experiments
2.
3.
4
5
6
7
8
9
10
11
* Students are expected to be ready with the prerequisite before attending the lab
Program No.01
PART A
(PART A: TO BE REFFERED BY STUDENTS)
A.2 Prerequisite
Computer Programming I, and II
A.3 Outcome
After successful completion of this experiment students will be able to
A.4 Theory
If the binary code for your platform is not available, you need a C compiler to compile the source
code manually. Compiling the source code offers more flexibility in terms of choice of features that
you require in your installation
Syntax:
Operators:
Program 1: On operators
Type each of the following expressions. Copy the values in observation book.
a. (4+5)*8/2
b. 4+5*8/2
Compare answer with previous expression
c. 5//4
d. 3 ** 3, 3.0**3
e. x=true y=false
x and y
h. x= ‘hello world’
find output for: h in x, hello not in x
j. Find error:
x=1;
print ’sin(%g)=%g’ % (x, sin(x))
2. Write a program in python to find out if the given year is leap year
>>> (4+5)*8/2
36.0
>>> 4+5*8/2
24.0
>>> 5//4
1
>>> 3**3
27
>>> 3.0**3
27.0
>>> x = True
>>> y =False
>>> x and y
False
>>> x = 10
>>> y = 4
>>> x|y
14
>>> x<<2
40
>>> x>>2
2
>>>x1= 'hello'
>>>y1=’hello’
>>> x1 is not y1
False
>>> 'h' in x
True
>>> 'hello' not in x
False
>>> C=20.9
>>> type(C)
<class 'float'>
>>> D = int(C)
>>> type(D)
<class 'int'>
>>> D
20
PROGRAM 2 :
1.
a = int(input("side 1 : "))
b = int(input("side 2 : "))
c = int(input("side 3 : "))
s = (a+b+c)/2.0
if(s>a and s>b and s>c):
if(a==b and a==c):
print ("EQUILATERAL")
elif(a==b or b==c or a ==c ):
print ("ISOCELES")
else:
print ("SCALENE")
2.
year = int(input("ENTER YEAR : "))
if(year % 400 == 0):
print ("LEAP YEAR")
elif(year % 100 == 0):
print("NOT LEAP YEAR")
elif(year % 4 == 0):
print("LEAP YEAR")
if(a == sum):
print ("ARMSTRONG NUMBER")
else:
print("NOT ARMSTRONG NUMBER")
B.2 Input and Output:
(Paste your program input and output in following format. If there is error then paste the
specific error in the output part. In case of error with due permission of the faculty extension
can be given to submit the error free code with output in due course of time. Students will be
graded accordingly.)
PROGRAM2:
1.
side 1 : 3
side 2 : 3
side 3 : 4
ISOCELES
side 1 : 3
side 2 : 4
side 3 : 5
SCALENE
side 1 : 3
side 2 : 3
side 3 : 3
EQUILATERAL
2.
ENTER YEAR : 1900
NOT LEAP YEAR
3.
ENTER NUMBER : 371
ARMSTRONG NUMBER
ENTER NUMBER : 123
NOT ARMSTRONG NUMBER
B.3 Conclusion:
(Students must write the conclusion as per the attainment of individual outcome listed above
and learning/observation noted in section B.1)