Program file class12
Program file class12
Output:
Output:
Program 3: Write a Program to check if the entered
number is Armstrong or not.
Output:
OR
Output:
Output:
Program 6: Write a Program to enter the string and to
check if it’s palindrome or not using loop.
Output:
OR
Output:
OR
Output: Yes
Program 7: Recursively find the factorial of a natural
number.
Output:
Output:
Program 10 Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in
the file.
Output:
Program 11 Create a binary file with name and roll no.
Search for a given roll number and display the name, if
not found display appropriate message.
Output:
Output:
Program 12 Write a random number generator that
generates random numbers between 1 and 6(simulates
a dice)
Output:
Stack Concept:
Output:
Queue Concept:
Output:
a=fh.readline()
words=a.split()
for j in words:
item.append(j)
if a =="":
break
print("#".join(item))
Output:
Program 15 Create a student table and insert data. Implement the
ALTER table to add new attributes / modify data type / drop attribute
GROUP BY and find the min, max, sum, count and average
#Switched to a database
mysql> USE GVKCV;
Database changed
#Describing table
mysql> desc student;
+-----------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+-------+
| ROLLNO | int | NO | PRI | NULL | |
| NAME | char(10) | YES | | NULL | |
| TELUGU | char(10) | YES | | NULL | |
| HINDI | char(10) | YES | | NULL | |
| MATHS | char(10) | YES | | NULL | |
| computers | char(10) | YES | | NULL | |
+-----------+----------+------+-----+---------+-------+
6 rows in set (0.21 sec)
#Droping a attribute
mysql> alter table student
-> drop column computers;
Query OK, 0 rows affected (0.93 sec)
Records: 0 Duplicates: 0 Warnings: 0
#Describing table
mysql> desc student;
+--------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+----------+------+-----+---------+-------+
| ROLLNO | int | NO | PRI | NULL | |
| NAME | char(10) | YES | | NULL | |
| TELUGU | char(10) | YES | | NULL | |
| HINDI | char(10) | YES | | NULL | |
| MATHS | char(10) | YES | | NULL | |
+--------+----------+------+-----+---------+-------+
5 rows in set (0.14 sec)
#ORDER BY BRANCH
#ACTUAL DATA
mysql> SELECT *FROM STUDENT;
+--------+--------+----------+--------+-------+-------+
| ROLLNO | BRANCH | NAME | TELUGU | HINDI | MATHS |
+--------+--------+----------+--------+-------+-------+
| 102 | MPC | student2 | 60 | 61 | 62 |
| 103 | BIPC | student3 | 70 | 71 | 72 |
| 104 | BIPC | student4 | 80 | 81 | 82 |
| 105 | BIPC | student5 | 90 | 91 | 92 |
| 106 | BIPC | student6 | 40 | 41 | 42 |
| 107 | MPC | student7 | 63 | 64 | 65 |
+--------+--------+----------+--------+-------+-------+
6 rows in set (0.00 sec)