PHP SEM 2
PHP SEM 2
SOLUTION-
OUTPUT-
QUESTION-2
WAP to calculate simple interest, input enter by the user.
SOLUTION-
OUTPUT-
3|Page P.T.O
QUESTION-3
WAP to calculate area of a rectangle, input enter by the user.
SOLUTION-
4|Page P.T.O
OUTPUT-
5|Page P.T.O
QUESTION-4
WAP to calculate the parameter of a circle, input enter by the user.
SOLUTION-
6|Page P.T.O
OUTPUT-
7|Page P.T.O
QUESTION-5
WAP to convert the temperature into ˚F to ˚C, input enter by the user.
SOLUTION-
8|Page P.T.O
OUTPUT-
9|Page P.T.O
QUESTION-6
WAP to check the number whether it is prime or not, input enters by the user.
SOLUTION-
OUTPUT-
11 | P a g e P.T.O
QUESTION-7
WAP to print the odd number series, input enter by the user.
SOLUTION-
12 | P a g e P.T.O
OUTPUT-
13 | P a g e P.T.O
QUESTION-8
WAP to generate the odd & even number series, the range input by the user.
SOLUTION-
14 | P a g e P.T.O
OUTPUT-
15 | P a g e P.T.O
QUESTION-9
WAP to generate the series which divisible by 9, the range input by the user.
SOLUTION-
16 | P a g e P.T.O
OUTPUT-
17 | P a g e P.T.O
QUESTION-10
WAP to check the number whether it is Armstrong or not, number input by the user.
SOLUTION-
18 | P a g e P.T.O
OUTPUT-
19 | P a g e P.T.O
QUESTION-11
WAP to find the factorial of a number, input enter by the user.
SOLUTION-
20 | P a g e P.T.O
OUTPUT-
21 | P a g e P.T.O
QUESTION-12
22 | P a g e P.T.O
SOLUTION-
23 | P a g e P.T.O
OUTPUT-
24 | P a g e P.T.O
QUESTION-13
WAP to print the fabonnaic series, input range entered by the user.
SOLUTION:
25 | P a g e P.T.O
OUTPUT-
26 | P a g e P.T.O
QUESTION-14
WAP to check the year value whether it is leap year or not, input enter by the user.
SOLUTION-
27 | P a g e P.T.O
OUTPUT-
28 | P a g e P.T.O
QUESTION-15
WAP to take inputs of 5 student’s records related to 5 subjects marks & calculate their Total
Marks, Percentage, Grade Value (using switch cases & arrays).
SOLUTION-
29 | P a g e P.T.O
OUTPUT-
30 | P a g e P.T.O
31 | P a g e P.T.O
QUESTION-16
WAP to calculate the factorial of a number using recursive function, input entered by the user.
SOLUTION-
32 | P a g e P.T.O
OUTPUT-
33 | P a g e P.T.O
QUESTION-17
WAP to calculate the sum of digits using function, input entered by the user.
SOLUTION-
34 | P a g e P.T.O
OUTPUT-
35 | P a g e P.T.O
QUESTION-18
SOLUTION-
36 | P a g e P.T.O
OUTPUT-
37 | P a g e P.T.O
QUESTION-19
SOLUTION-
38 | P a g e P.T.O
OUTPUT-
39 | P a g e P.T.O
QUESTION-20
SOLUTION-
40 | P a g e P.T.O
OUTPUT-
41 | P a g e P.T.O
QUESTION-21
SOLUTION-
42 | P a g e P.T.O
OUTPUT-
43 | P a g e P.T.O
QUESTION-22
SOLUTION-
44 | P a g e P.T.O
OUTPUT-
45 | P a g e P.T.O
QUESTION-23
WAP to print the following pattern:
1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
12345678910987654321
SOLUTION
46 | P a g e P.T.O
OUTPUT-
47 | P a g e P.T.O
WAP to build a connection with MySQL server and create a database name as mydb.
SOLUTION-
48 | P a g e P.T.O
WAP to create a employee table in mydb database which have fields like Emp_Id, Emp_Name,
Emp_Salary, Emp_DOB.
SOLUTION-
49 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
QUESTION-26
WAP to insert atleast 10 records in employee table, which is inside mydb database.
SOLUTION-
50 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
QUESTION-27
WAP to update any one record in the employee table, which is in mydb database
SOLUTION-
51 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
QUESTION-28
WAP to design a format & display all records from the employee table, which is in mydb
database.
SOLUTION-
52 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
53 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
QUESTION-29
WAP to delete a particular record form the employee table, which is in mydb database.
SOLUTION-
54 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
QUESTION-30
WAP to design a format & display all records from the employee table, which is in mydb
database (Using select query with order by clause).
SOLUTION-
55 | P a g e P.T.O
JASMEHER KAUR TALWAR 02716702023 BCA, SEMESTER 2
56 | P a g e P.T.O