COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential...

55
A PRACTICAL RECORD BOOK OF COMPUTER SCIENCE (PCMC) FIRST PUC MORARJI DESAI RESIDENTIAL PU SCIENCE COLLEGE, DUDDA, HASSAN

Transcript of COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential...

Page 1: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

A

PRACTICAL RECORD

BOOK

OF

COMPUTER SCIENCE (PCMC)

FIRST PUC

MORARJI DESAI RESIDENTIAL PU

SCIENCE COLLEGE, DUDDA, HASSAN

Page 2: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

MORARJI DESAI RESIDENTIAL PUSCIENCE COLLEGE, DUDDA, HASSAN

This is to certify that Mr. / Mrs. ………………………………

has satisfactorily completed the course of experiments in practical

COMPUTER SCIENCE prescribed by the Pre-University,

Bangalore for FIRST PUC (P.C.M.C) course in the laboratory of

this college in the year 2018-19.

Signature of the Lecturer Head of the Department

Date: …………………..

Name of the Candidate: ………………………........

Register Number : ………………………........

Examination Centre : ………………………........

Date of Practical Examination: ………………….....

LLaabboorraattoorryy

CCeerrttiiffiiccaattee

Page 3: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

CONTENTSPgmNo

Program Name PageNo

SECTION - A (C++)

01

Write a program to interchange the values of two variablesa. Using a third variable.b. Without using a third variable.

01

02 Write a program to find the area and circumference of a circle. 03

03 Write a program to find the area of a triangle given three sides. 04

04Write a program to convert days into years, months and days.(Hint: Assume all months have 30 days)

05

05Write a program to find the largest, smallest and second largest of three numbers usingsimple if statement.

06

06

Write a program to input the total amount in a bill, if the amount is greater than 1000 thediscount of 8% is given otherwise no discount is given, output the total amount, the discountamount and the final amount, use simple if statement.

07

07 Write a program to check whether a given year is a leap year or not using if- else statement. 08

08Write a program to input a character and find out whether it is a lower case or upper casecharacter using if-else statement.

09

09

Write a program to input the number of units of electricity consumed in a house andcalculate the final amount using nested-if statement. Use the following data for calculation

Units Consumed Cost< 30 Rs 3.50 / unit

>=30 and <50 Rs 4.25 / unit>=50 and < 100 Rs 5.25 / unit

>=100 Rs 5.85 /unit

10

10

Write a program to input the marks of four subjects, calculate the total percentage and outputthe result as either “First class”, or “Second class”, or “Pass class” or “Fails” using switchstatement.

Class Range %First Class Between 60 and 100%

Second Class Between 50 and 59%Pass Class Between 40 and 49%

Fails Less than 40%

11

11 Write a program to find the sum of all the digits of a number using while statement. 13

12Write a program to input principal amount, rate of interest and time period and calculatecompound interest using while statement. (Hint: CI = P * (1 + R / 100) T).

14

13 Write a program to check whether a given number is a power of 2. 15

14Write a program to check whether a given number is an Armstrong number using do-whilestatement (Hint: 153 = 13 + 53+ 33).

16

15 Write a program to find the factorial of a number using for statement. 17

16 Write a program to generate the Fibonacci sequence up to a limit using for statement. 18

17 Write a program to find the sum and average of “N” numbers. 19

Page 4: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

18 Write a program to find the second largest of “N” numbers. 20

19 Write a program to arrange a list of numbers in ascending order. 21

20 Write a program to find the position of a given number in an array. 22

21 Write a program to sum of all the rows and the sum of all the columns of a matrix separately. 23

22 Write a program to find the sum of two compatible matrices. 24

23

Consider an array MARKS [20] [5] which stores the marks obtained by 20 students in 5subjects. Now write a program to:

a) Find the average marks obtained in each subjectb) Find the average marks obtained by every studentc) Find the number of students who have scored below 50 in their average

26

24 Write a program to check whether a given string is a palindrome or not. 28

25 Write a program to count the number of vowels and consonants in a string. 29

26 Write a program to find the GCD and LCM of two numbers using functions. 30

27 Write a program to find XY using functions. 31

28Write a program to input the register number, name and class of all the students in a classinto a structure and output the data in a tabular manner with proper heading

32

SECTION – B (SPREADSHEET)

01

Eight salesmen sell three products for a week. Using a spreadsheet create a sales report.The report should include the name of the salesman, Amount of sales for each product andthe salesman’s total sales in the format given below.

Sales for the Month

Name Total Amt.for product1

Total Amt.for product2

Total Amt.for product3

Total sales

a) Type in all text and numbers in the spreadsheet.b) Format all numbers as a currency.c) Center the spreadsheet headings across the spreadsheet.d) Format all text.e) Create formulas to display a total for each sales rep.f) Create formulas to display a total for each product.g) Create a formula to calculate the total sales for all sales rep's for the month.

34

02

Enter the following details for 10 employees Employee Code, Employee name, Basic salary,DA, HRA, Loans, Total salary and Tax.

Salary for the MonthEmployee

CodeEmployee

NameBasicSalary

DA HRA Loan TotalSalary

AnnualSalary

Tax

a) Type the Employee Code, Employee Name, Basic Salary and Loan amount datafor 10 employees in the spreadsheet.

b) Format all numbers as a currency.c) Center the spreadsheet headings across the spreadsheet.d) Format all text.

36

Page 5: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

e) Create a formula to compute DA as 50% of the Basic salary and copy this to all thecells.

f) Create a formula to compute HRA as 12% of the Basic salary and copy this to all thecells.

g) Create a formula to compute Total salary and copy this to all the cells.h) If Total salary is greater than 500000, compute Tax as 20% of Total salary otherwise

10% of the Total salary using a formula.

03

Enter the following details for 10 Students Register Number, Name, Subject1 Marks,Subject2 Marks, Subject3 Marks, Subject4 Marks, Total Marks and Percentage.

Test Marks data of a ClassRegisterNumber Name

Subject1Marks

Subject2Marks

Subject3Marks

Subject4Marks

TotalMarks Percentage

a) Type the Register Number, Name and marks of four subjects for 10students in thespreadsheet.

b) Format all text and numeric data appropriately.c) Center the spreadsheet headings across the spreadsheet.d) Create a formula to compute the Total marks and copy this to all the cells.e) Create a formula to compute Percentage and copy this to all the cells.f) Create a formula to compute the highest and lowest score using a library

function.g) Draw a bar graph for Register Number against total marks.h) Draw Pie chart for one student showing his marks in different subject from total score

38

04

A housewife maintains the budget expenditure in a spreadsheet under the headingsIncome and Expenses. Income includes husband’s and Wife’s income separately underdifferent headings. Expenses include Rent, Bills, Household expenses and medical expenses.

Budget for the MonthIncome Expenses Total

Expenditure SavingsHusband Wife Rent Bills Household Medical

a) Type the Income and Expenses data for the entire month in the spreadsheet.b) Format all numbers as currency.c) Center the spreadsheet headings across the spreadsheet.d) Create a formula to compute the Total expenditure and copy this to all the cells.e) Create a formula to compute the savings and copy this to all the cells.f) Draw a bar graph to show expenditure under each heading.g) Draw Pie chart to show the distribution of salary.

41

SECTION-C (HTML)

01 Create a Web page to display your details using different tags. 44

02 Create a model Web site for your college making using different tags. 46

Page 6: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

SECTION – A

C++

Page 7: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e

PROGRAM 1(a):

Write a C++ program to interchange the values of two variables using athird variable.

#include<iostream.h>

#include<conio.h>

void main( )

{

int a, b, temp;

clrscr( );

cout<<"Enter the two numbers";

cin>>a>>b;

cout<<"Before Interchanging : a = " <<a<<" and b = "<<b<<endl;

temp = a;

a = b;

b = temp;

cout<<"After Interchanging : a = " <<a<<" and b = "<<b<<endl;

getch();

}

OUTPUT:

Page 8: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 2 | P a g e

PROGRAM 1(b):

Write a C++ program to interchange the values of two variables withoutusing third variable.

#include<iostream.h>

#include<conio.h>

void main( )

{

int a, b;

clrscr( );

cout<<"Enter the two numbers:"<<endl;

cin>>a>>b;

cout<<"Before Interchanging : a = " <<a<<" and b = "<<b<<endl;

a = a + b ;

b = a - b ;

a = a - b ;

cout<<"After Interchanging : a = " <<a<<" and b = "<<b<<endl;

getch();

}

OUTPUT:

Page 9: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 3 | P a g e

PROGRAM 2:

Write a C++ program to find the area and circumference of a circle.

#include<iostream.h>

#include<conio.h>

void main( )

{

float rad, area, circum;

clrscr( );

cout<<"Enter the radius:";

cin>>rad;

area = 3.142 * rad * rad;

circum = 2 * 3.142 * rad;

cout<<"Area of circle = "<<area<<endl;

cout<<"Circumference of circle = "<<circum<<endl;

getch();

}

OUTPUT 1:

OUTPUT 2:

Page 10: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 4 | P a g e

PROGRAM 3:

Write a C++ program to find the area of triangle given three sides.

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main( )

{

float s1, s2, s3, s, area;

clrscr( );

cout<<"Enter the length of three sides:";

cin>>s1>>s2>>s3;

s = (s1 + s2+ s3)/2;

area = sqrt( s* (s-s1) * (s-s2) * (s-s3));

cout<<"Area of triangle = "<<area<<endl;

getch();

}

OUTPUT 1:

OUTPUT 2:

Page 11: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 5 | P a g e

PROGRAM 4:

Write a C++ program to convert days into years, months and days.(Hint: Assume all months have 30 days)

#include<iostream.h>

#include<conio.h>

void main( )

{

int totaldays, days, year, month;

clrscr( );

cout<<"Enter the total days:";

cin>>totaldays;

year = totaldays/365;

totaldays = totaldays % 365;

month = totaldays/30;

days = totaldays % 30;

cout<<"Years = "<< years<<endl;

cout<<"Months = "<<month<<endl;

cout<<"Days = "<<days<<endl;

getch();

}

OUTPUT 1:

OUTPUT 2:

Page 12: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 6 | P a g e

PROGRAM 5:

Write a C++ program to find the largest, smallest and second largest ofthree numbers using simple if statement.

#include<iostream.h>

#include<conio.h>

void main( )

{

int a, b, c;

int largest, smallest, seclargest;

clrscr( );

cout<<"Enter the three numbers"<<endl;

cin>>a>>b>>c;

largest = a; //Assume first number as largest

if(b>largest)

largest = b;

if(c>largest)

largest = c;

smallest = a; //Assume first number as smallest

if(b<smallest)

smallest = b;

if(c<smallest)

smallest = c;

seclargest = (a + b + c) - (largest + smallest);

cout<<"Smallest Number is = "<<smallest<<endl;

cout<<"Second Largest Number is = "<<seclargest<<endl;

cout<<"Largest Number is = "<< largest<<endl;

getch( );

}

OUTPUT:

Page 13: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 7 | P a g e

PROGRAM 6:

Write a C++ program to input the total amount in a bill, if the amount isgreater than 1000, a discount of 8% is given. Otherwise, no discount is given.Output the total amount, discount and the final amount. Use simple if statement.

#include<iostream.h>

#include<conio.h>

void main( )

{

float TAmount, discount, FAmount ;

clrscr( );

cout<<"Enter the Total Amount"<<endl;

cin>>TAmount;

discount = 0; //Calculate Discount

if(TAmount>1000)

discount = (8/100.0) * TAmount;

FAmount = TAmount - discount; //Calculate Final Amount

cout<<"Total Amount = "<<TAmount<<endl;

cout<<"Discount = "<<discount<<endl;

cout<<"Final Amount = "<< FAmount<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 14: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 8 | P a g e

PROGRAM 7:

Write a C++ program to check whether a given year is a leap year not,

Using if - else statement.

#include<iostream.h>

#include<conio.h>

void main( )

{

int year ;

clrscr( );

cout<<"Enter the Year in the form YYYY"<<endl;

cin>>year;

if(year%4 ==0 && year%100!=0 || year%400 ==0)

cout<<year<<" is a leap year"<<endl;

else

cout<<year<<" is not leap year"<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 15: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 9 | P a g e

PROGRAM 8:

Write a C++ program to accept a character. Determine whether the

character is a lower-case or upper-case letter.

#include<iostream.h>

#include<conio.h>

void main( )

{

char ch ;

clrscr( );

cout<<"Enter the Character"<<endl;

cin>>ch;

if(ch>= 'A' && ch <='Z')

cout<<ch<<" is an Upper-Case Character"<<endl;

else

if(ch>= 'a' && ch <='z')

cout<<ch<<" is an Lower-Case Character"<<endl;

else

cout<<ch<<" is not an alphabet"<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

OUTPUT 3:

Page 16: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 10 | P a g e

PROGRAM 9:

Write a C++ program to input the number of units of electricity

consumed in a house and calculate the final amount using nested-if statement.

Use the following data for calculation.

Units consumed Cost< 30 Rs. 3.50 / Unit

>= 30 and < 50 Rs. 4.25 / Unit>= 50 and < 100 Rs. 5.25 / Unit

>= 100 Rs. 5.85 / Unit#include<iostream.h>#include<conio.h>void main( ){

int units ;float Billamount;clrscr( );cout<<"Enter the number of units consumed:"<<endl;cin>>units;if(units < 30)

Billamount = units * 3.50 ;elseif(units < 50)

Billamount = 29 * 3.50 + (units - 29) * 4.25 ;elseif(units < 100)

Billamount = 29 * 3.50 + 19 * 4.25 + (units - 49) * 5.25 ;else

Billamount = 29 * 3.50 + 19 * 4.25 + 49 * 5.25 + (units - 99) * 5.85 ;

cout<<"Total Units Consumed ="<<units<<endl;cout<<"Total Amount = "<<Billamount<<endl;getch( );

}OUTPUT:

Page 17: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 11 | P a g e

PROGRAM 10:

Write a C++ program to input the marks of four subjects. Calculate the

total percentage and output the result as either “First Class” or “Second Class”

or “Pass Class” or “Fail” using switch statement.

Class Range (%)First Class Between 60% to 100%

Second Class Between 50% to 59%Pass Class Between 40% to 49%

Fail Less than 40%#include<iostream.h>

#include<conio.h>

void main( )

{

int m1, m2, m3, m4, total, choice;

float per;

clrscr( );

cout<<"Enter the First subject marks:";

cin>>m1;

cout<<"Enter the Second subject marks:";

cin>>m2;

cout<<"Enter the Third subject marks:";

cin>>m3;

cout<<"Enter the Fourth subject marks:";

cin>>m4;

total = m1 + m2 + m3 + m4;

per = total / 4.0;

cout<<"Total Marks = "<<total<<endl;

cout<<"Percentage = "<<per<<endl;

choice = (int) per/10;

cout<<"The result of the student is: "<<endl;

switch(choice)

{

case 10:

Page 18: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 12 | P a g e

case 9:

case 8:

case 7:

case 6: cout<<"First Class "<<endl;

break;

case 5: cout<<"Second Class"<<endl;

break;

case 4: cout<<"Pass Class"<<endl;

break;

default: cout<<"Fail"<<endl;

}

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 19: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 13 | P a g e

PROGRAM 11:

Write a C++ program to find sum of all the digits of a number using while

statement.

#include<iostream.h>

#include<conio.h>

void main( )

{

int num, sum, rem;

clrscr( );

cout<<"Enter the Number"<<endl;

cin>>num;

sum = 0;

while(num!=0)

{

rem = num % 10;

sum = sum + rem;

num = num/10;

}

cout<<"Sum of the digits is "<<sum<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 20: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 14 | P a g e

PROGRAM 12:

Write a C++ program to input principal amount, rate of interest and time

period. Calculate compound interest using while statement.

(Hint: Amount = P * (1 + R/100)T, Compound Interest = Amount – P)

#include<iostream.h>

#include<conio.h>

void main( )

{

float pri, amt, priamt, rate, ci;

int time, year;

clrscr( );

cout<<"Enter the Principal amount, rate of interest and time:"<<endl;

cin>>pri>>rate>>time;

year = 1;

priamt = pri;

while(year <= time)

{

amt = pri * (1 + rate/100);

pri=amt;

year ++;

}

ci = amt - priamt;

cout<<"Compound Interest = "<<ci<<endl;

cout<<"Net Amount = "<<amt<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 21: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 15 | P a g e

PROGRAM 13:

Write a C++ program to check whether the given number is power of 2.

#include<iostream.h>

#include<conio.h>

void main( )

{

int num, m, flag;

clrscr( );

cout<<"Enter the Number"<<endl;

cin>>num;

m = num;

flag = 1;

while(num>2)

if(num % 2 ==1)

{

flag = 0;

break;

}

else

num = num/2;

if(flag)

cout<<m<<" is power of 2 "<<endl;

else

cout<<m<<" is not power of 2 "<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 22: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 16 | P a g e

PROGRAM 14:

Write a C++ program to check whether the given number is an

Armstrong Number using do-while statement. (Hint: 153 = 13 + 53 + 33)

#include<iostream.h>

#include<conio.h>

void main( )

{

int num, rem, sum, temp;

clrscr( );

cout<<"Enter the three digit number"<<endl;

cin>>num;

temp = num;

sum = 0;

do

{

rem = temp % 10;

sum = sum + rem * rem * rem;

temp = temp / 10;

}while(temp!=0);

if(sum == num)

cout<<num<<" is an Armstrong Number "<<endl;

else

cout<<num<<" is not an Armstrong Number "<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 23: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 17 | P a g e

PROGRAM 15:

Write a C++ program to find the factorial of a number using for

statement. (Hint: 5! = 5 * 4 * 3 * 2 * 1 = 120)

#include<iostream.h>

#include<conio.h>

void main( )

{

int num, fact, i;

clrscr( );

cout<<"Enter the number"<<endl;

cin>>num;

fact = 1;

for( i = 1; i<= num; i++)

fact = fact * i;

cout<<" The factorial of a "<<num<<"! is: "<<fact<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 24: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 18 | P a g e

PROGRAM 16:

Write a C++ program to generate the Fibonacci sequence up to a limit

using for statement. (Hint: 5 = 0 1 1 2 3)

#include<iostream.h>

#include<conio.h>

void main( )

{

int num, first, second, count, third;

clrscr( );

cout<<"Enter the number limit for Fibonacci Series"<<endl;

cin>>num;

first = 0;

second = 1;

cout<<first<<"\t"<<second;

third = first + second;

for( count = 2; third<=num; count++)

{

cout<<"\t"<<third

first = second;

second = third;

third = first + second;

}

cout<<"\n Total terms = "<<count<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 25: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 19 | P a g e

PROGRAM 17:

Write a C++ program to find the sum and average of n number of the

array.

#include<iostream.h>

#include<conio.h>

#include<iomanip.h>

void main( )

{

int a[50], i, n, sum;

float avg;

clrscr();

cout<<"How many elements?"<<endl;

cin>>n;

cout<<"Enter the elements:"<<endl;

for(i=0; i<n; i++)

cin>>a[i];

sum = 0;

for(i=0; i<n; i++)

sum = sum + a[i];

avg=(float) sum / n;

cout<<"Sum = "<<sum<<endl;

cout<<"Average = "<<avg<<endl;

getch( );

}

OUTPUT:

Page 26: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 20 | P a g e

PROGRAM 18:

Write a C++ program to find the second largest of n number in the array.

#include<iostream.h>#include<conio.h>#include<iomanip.h>void main( ){

int a[50], i, n, largest, secondlar;clrscr( );cout<<"How many elements?"<<endl;cin>>n;cout<<"Enter the elements:"<<endl;for(i=0; i<n; i++)

cin>>a[i];if(a[0] > a[1]){

largest = a[0];secondlar = a[1];

}else{

largest=a[1];secondlar=a[0];

}for(i=2; i<n; i++)if(a[i] > largest){

secondlar = largest;largest = a[i];

}elseif(a[i] > secondlar)

secondlar = a[i];cout<<"Largest = "<<largest<<endl;cout<<"Second Largest = "<<secondlar<<endl;getch( );

}OUTPUT:

Page 27: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 21 | P a g e

PROGRAM 19:

Write a C++ program to arrange a list of numbers in ascending order.

Sorting: The process of arrangement of data items in ascending or descending order is called

sorting.

#include<iostream.h>

#include<conio.h>

#include<iomanip.h>

void main( )

{

int a[50], i, temp, j, n;

clrscr( );

cout<<"Enter the number of elements:"<<endl;

cin>>n;

cout<<"Enter the elements:"<<endl;

for(i=0; i<n; i++)

cin>>a[i];

for(i=1; i<n; i++)

{

for(j=0; j<n-i; j++)

if(a[j] > a[j+1])

{

temp = a[j];

a[j] = a[j+1];

a[j+1] = temp;

}

}

cout<<"The sorted elements are:"<<endl;

for(i=0; i<n; i++)

cout<<a[i]<<"\t";

getch( );

}

OUTPUT:

Page 28: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 22 | P a g e

PROGRAM 20:

Write a C++ program to find position of a given number in the array.

Searching: The process of finding the position of a data item in the given collection of data items is

called searching.

#include<iostream.h>#include<conio.h>#include<iomanip.h>void main( ){

int a[50], i, pos, ele, n;clrscr( );cout<<"Enter the number of elements:"<<endl;cin>>n;cout<<"Enter the elements:"<<endl;for(i=0; i<n; i++)

cin>>a[i];cout<<"Enter the search element:"<<endl;cin>>ele;pos=-1;for(i=0; i<n; i++)

if(ele == a[i]){

pos = i;break;

}if(pos >= 0)

cout<<ele<<" is present at position "<<pos<<endl;else

cout<<ele<<" is not present"<<endl;getch( );

}OUTPUT 1: OUTPUT 2:

Page 29: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 23 | P a g e

PROGRAM 22:

Write a C++ program to sum of all the row and sum of all the column in

matrices separately.

#include<iostream.h>#include<conio.h>void main( ){

int a[5][5], r, c, i, j, rsum, csum;clrscr( );cout << "Enter the order of matrix: ";cin >> r>>c;

// Storing elements of matrix entered by user.cout << "Enter elements of the matrix: " << endl;for (i = 0; i < r; i++)

for (j = 0; j < c; j++)cin >> a[i][j];

for(i = 0; i < r; i++){

rsum = 0;for(j = 0; j < c; j++)

rsum = rsum + a[i][j];cout<<"Sum of row no "<<i+1<<" = "<<rsum<<endl;

}for(i = 0; i < c; i++){

csum = 0;for(j = 0; j < r; j++)

csum = csum + a[j][i];cout<<"Sum of column no "<<i+1<<" = "<<csum<<endl;

}getch( );

}OUTPUT 1:

Page 30: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 24 | P a g e

PROGRAM 23:

Write a C++ program to find the sum of two compatible matrices:

#include<iostream.h>

#include<conio.h>

void main( )

{

int a[5][5], b[5][5], sum[5][5], r1, c1, r2, c2, i, j;

clrscr( );

cout << "Enter the order of first matrix: ";

cin >> r1>>c1;

cout << "Enter the order of second matrix: ";

cin >> r2>>c2;

// Storing elements of first matrix entered by user.

cout << "Enter elements of 1st matrix: " << endl;

for (i = 0; i < r1; i++)

for (j = 0; j < c1; j++)

cin >> a[i][j];

// Storing elements of second matrix entered by user.

cout << "Enter elements of 2nd matrix: " << endl;

for(i = 0; i < r2; i++)

for(j = 0; j < c2; j++)

cin >> b[i][j];

if ( (r1 == r2) && (c1==c2))

{

for(i = 0; i < r1; i++)

for(j = 0; j < c1; j++)

sum[i][j] = a[i][j] + b[i][j]; // Adding Two matrices

cout << "Sum of two matrix is: " << endl;

for(i = 0; i < r1; i++)

{

for(j = 0; j < c1; j++)

cout << sum[i][j] << "\t"; // Displaying the resultant sum matrix.

cout << endl;

Page 31: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 25 | P a g e

}

}

else

cout<<"Matrices are not compatible..."<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 32: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 26 | P a g e

PROGRAM 24:

Consider an array MARKS [20[5] which stores the marks obtained by 20

students in 5 subjects. Now write a program to:

a) Find the average marks obtained in each subject.

b) Find the average marks obtained by every student

c) Find the number of students who have scored below 50 in their

average.

#include<iostream.h>

#include<conio.h>

void main( )

{

int marks[20][5], n, s, total, count=0, i, j;

float average;

clrscr( );

cout << "Enter the number of students: ";

cin >> n;

cout << "Enter the number of subjects: ";

cin >> s;

cout << "Enter the marks: " << endl;

for (i = 0; i < n; i++)

for (j = 0; j < s; j++)

cin >> marks[i][j];

cout<<endl<<"Average of Subjects"<<endl;

cout<<"Sub1\tSub2\tSub3\tSub4\tSub5"<<endl;

for(i = 0; i < s; i++)

{

total = 0;

for(j = 0; j < n; j++)

total = total + marks[j][i];

average = total/n;

cout<<average<<"\t";

Page 33: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 27 | P a g e

}

cout<<endl<<"Average of students:"<<endl;

cout<<"\tStudent\tAverage"<<endl;

for(i = 0; i < n; i++)

{

total = 0;

for(j = 0; j < s; j++)

total = total + marks[i][j];

average = total/s;

if(average<50)

count++;

cout<<" \t"<<i+1<<"\t"<<average<<endl;

}

cout<<endl<<"Number of students less than average is "<<count<<endl;

getch( );

}

OUTPUT:

Page 34: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 28 | P a g e

PROGRAM 25:

Write a C++ program to determine whether the string is a palindrome.

#include<iostream.h>

#include<conio.h>

#include<string.h>

void main( )

{

char s[100], r[100]; //s is the string and r is the reserved string

clrscr( );

cout<<"Enter the String:";

cin.getline(s, 100);

strcpy (r, s); // Copy the characters of the string s to r

strrev (r); // Reverse the characters of the string r

if(strcmpi(s, r) == 0)

cout<<"It is palindrome"<<endl;

else

cout<<"It is not palindrome"<<endl;

getch( );

}

OUTPUT 1:

OUTPUT 2:

Page 35: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 29 | P a g e

PROGRAM 26:

Write a C++ program to count the number of vowels and consonants in a

string.

#include<iostream.h>

#include<conio.h>

#include<string.h>

#include<ctype.h>

void main( )

{

char s[100];

int len, i, cons=0, vow=0;

clrscr( );

cout<<"Enter the string:";

cin.getline(s,100);

len=strlen(s);

for(i=0;i<len;i++)

if( isalpha (s[i]) )

switch (toupper (s[i]) )

{

case'A':

case'E':

case'I':

case'O':

case'U': vow++;

break;

default: cons++;

}

cout<<"Number of Vowles:"<<vow<<endl;

cout<<"Number of Consonants:"<<cons<<endl;

getch();

}

OUTPUT 1: OUTPUT 2:

Page 36: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 30 | P a g e

PROGRAM 27:

Write a C++ program to find the GCD and LCM of two numbers using

functions.

#include<iostream.h>

#include<conio.h>

void main( )

{

int gcd(int, int); //Function Prototype

int a, b, g, lcm;

clrscr( );

cout<<"Enter two number:"<<endl;

cin>>a>>b;

g = gcd(a,b);

lcm = (a * b)/g;

cout<<"GCD of "<<a<<" and "<<b<<" is "<<g<<endl;

cout<<"LCM of "<<a<<" and "<<b<<" is "<<lcm<<endl;

getch( );

}

int gcd( int x, int y)

{

int rem;

while(y != 0)

{

rem = x % y;

x = y;

y = rem;

}

return(x);

}

OUTPUT 1: OUTPUT 2:

Page 37: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 31 | P a g e

PROGRAM 28:

Write a C++ program to find Xy using functions.

#include<iostream.h>

#include<conio.h>

void main( )

{

float power(float,int);

float x;

int y;

clrscr( );

cout<<"Enter the Base and Exponent:"<<endl;

cin>>x>>y;

cout<<x<<" to the power of "<<y<<" ="<<power(x,y)<<endl;

getch( );

}

float power(float a, int n)

{

if(a==0)

return 0.0;

if(n==0)

return 1.0;

else

if(n>0)

return(a * power(a,n-1));

else

return(power(a, n+1)/a);

}

OUTPUT 1:

OUTPUT 2: OUTPUT 3:

Page 38: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 32 | P a g e

PROGRAM 30:

Write a C++ program to input the register number, name and class of all

the students in a class into a structure and output the data in a tabular manner

with proper heading.

#include<iostream.h>

#include<conio.h>

struct student

{

int regno;

char name[15];

char section[4];

};

void main( )

{

student s[50];

int i, j, n;

clrscr( );

cout<<"How many students?"<<endl;

cin>>n;

for(i=0; i<n; i++)

{

cout<<"Enter the Reg No of the Student "<<i+1<<":";

cin>>s[i].regno;

cout<<"Enter the Name of the Student "<<i+1<<":";

cin>>s[i].name;

cout<<"Enter the Class of the Student "<<i+1<<":";

cin>>s[i].section;

}

cout<<"REG_NO \t NAME \t CLASS \t"<<endl;

for(i=0; i<n; i++)

cout<<s[i].regno<<"\t"<<s[i].name<<"\t"<< s[i].section<<endl;

getch( );

}

Page 39: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

C++ Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 33 | P a g e

OUTPUT:

Page 40: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

SECTION– B

SPREADSHEET

Page 41: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 34 | P a g e

PROGRAM 1:

Eight salesmen sell three products for a week. Using a spreadsheet create a sales

report. The report should include the name of the salesman, Amount of sales for each product

and the salesman’s total sales in the format given below.

Sales for the Month

Name Total Amt. forproduct1

Total Amt. forproduct2

Total Amt. forproduct3

Total sales

a) Type in all text and numbers in the spreadsheet.

b) Format all numbers as a currency.

c) Center the spreadsheet headings across the spreadsheet.

d) Format all text.

e) Create formulas to display a total for each sales rep.

f) Create formulas to display a total for each product.

g) Create a formula to calculate the total sales for all sales rep's for the month.

Solution: Click on Start ProgramsMicrosoft OfficeMicrosoft Office Excel 2007.

This will open a new excel workbook displaying a blank Excel worksheet.

a) To Type in all text and numbers in the spreadsheet.

Now enter data of eight salesmen in the worksheet.

b) To Format all numbers as a currency.

i. Select the range B3:D10

ii. Home cells Format Format Cells or Right click on the range, select Format cells

from the short-cut menu, a Format cells window appears on the screen.

iii. Select the Number tab and choose proper Currency from the category list box.

iv. Click on OK.

c) To Center the spreadsheet headings across the spreadsheet.

Select the range A1:E1 then choose Home AlignmentMerge & Center.

d) To Format all text.

i. Select the range.

ii. Home cells Format Format Cells or Right click on the range, select Format cells

from the short-cut menu, a Format cells window appears on the screen.

iii. Select the Alignment tab and choose Center from the Horizontal list box. Select Center

from the vertical list box.

Page 42: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 35 | P a g e

iv. Click on OK.

e) Create formulas to display a total for each sales rep.

i. Enter the formula into cell E3.

= B3 + C3+ D3 or = SUM (B3:D3)

ii. Copy the formula (=B3 + C3+ D3) to cells from E4 to E10.

f) Create formulas to display a total for each product.

i. Enter the formula into cell B12.

= SUM (B3:B10)

ii. Copy the formula (=B3 + C3+ D3) to cells from C10 to D10.

g) Create a formula to calculate the total sales for all sales rep's for the month.

i. Enter the formula into cell C13.

= SUM (B3:D10)

OUTPUT:

Page 43: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 36 | P a g e

PROGRAM 2:

Enter the following details for 10 employees Employee Code, Employee name, Basic

salary, DA, HRA, Loans, Total salary and Tax.

Salary for the MonthEmployee

CodeEmployee

NameBasicSalary DA HRA Loan

TotalSalary

AnnualSalary Tax

a) Type the Employee Code, Employee Name, Basic Salary and Loan amount data for 10employees in the spreadsheet.

b) Format all numbers as a currency.c) Center the spreadsheet headings across the spreadsheet.d) Format all text.e) Create a formula to compute DA as 50% of the Basic salary and copy this to all the cells.f) Create a formula to compute HRA as 12% of the Basic salary and copy this to all the cells.g) Create a formula to compute Total salary and copy this to all the cells.h) If Total salary is greater than 500000, compute Tax as 20% of Total salary otherwise 10% of

the Total salary using a formula.

Solution: Click on Start ProgramsMicrosoft OfficeMicrosoft Office Excel 2007.

This will open a new excel workbook displaying a blank Excel worksheet.

a) To Type the Employee Code, Employee Name, Basic Salary and Loan amount datafor 10 employees in the spreadsheet.Now enter 10 employees’ data in the worksheet.

b) To Format all numbers as a currency.

i. Select the range C3:112

ii. Home cells Format Format Cells or Right click on the range, select Format cells

from the short-cut menu, a Format cells window appears on the screen.

iii. Select the Number tab and choose proper Currency from the category list box.

iv. Click on OK.

c) To Center the spreadsheet headings across the spreadsheet.

Select the range A1:I1 then choose Home AlignmentMerge & Center.

d) To Format all text.

i. Select the range.

ii. Home cells Format Format Cells or Right click on the range, select Format cells

from the short-cut menu, a Format cells window appears on the screen.

Page 44: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 37 | P a g e

iii. Select the Alignment tab and choose Center from the Horizontal list box. Select Center

from the vertical list box.

iv. Click on OK.

e) Create a formula to compute DA as 50% of the Basic salary and copy this to all the cells.

i. Enter the formula into cell D3.

= C3 * 50%

ii. Copy the formula (== C3 * 50%) to cells from D4 to D12.

f) Create a formula to compute HRA as 12% of the Basic salary and copy this to all the

cells.

i. Enter the formula into cell E3.

= C3 * 12%

ii. Copy the formula (= C3 * 12%) to cells from E4 TO E12.

g) Create a formula to compute Total salary and copy this to all the cells.

i. Enter the formula into cell G3.

= C3 + D3 + E3 – F3

ii. Copy the formula (= C3 + D3 + E3 – F3) to cells from G4 to G12.

i) If Total salary is greater than 500000, compute Tax as 20% of Total salary otherwise10% of the Total salary using a formula.i. Enter the formula into cell H3.

= G3 * 12

ii. Copy the formula (= G3 * 12) to cells from H4 to H12.

iii. Enter the formula into cell I3.

iv. =IF (H3>=500000, H3*20%, H3*10%)

v. Copy the formula (=IF (H3>=500000, H3*20%, H3*10%)) to cells from I4 to I12.

Page 45: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 38 | P a g e

PROGRAM 3:

Enter the following details for 10 Students Register Number, Name, Subject1 Marks,

Subject2 Marks, Subject3 Marks, Subject4 Marks, Total Marks and Percentage.

Test Marks data of a ClassRegisterNumber Name

Subject1Marks

Subject2Marks

Subject3Marks

Subject4Marks

TotalMarks Percentage

a) Type the Register Number, Name and marks of four subjects for 10students in the spreadsheet.

b) Format all text and numeric data appropriately.

c) Center the spreadsheet headings across the spreadsheet.

d) Create a formula to compute the Total marks and copy this to all the cells.

e) Create a formula to compute Percentage and copy this to all the cells.

f) Create a formula to compute the highest and lowest score using a library function.

g) Draw a bar graph for Register Number against total marks.

h) Draw Pie chart for one student showing his marks in different subject from total score.

Solution: Click on Start ProgramsMicrosoft OfficeMicrosoft Office Excel 2007.

This will open a new excel workbook displaying a blank Excel worksheet.

a) To Type the Register Number, Name, Marks of four subjects for 10 students in thespreadsheet.Now enter 10 students’ data in the worksheet.

b) To Format all text and numeric data appropriately as a currency.

i. Select the range B3:J12

ii. Home cells Format Format Cells or Right click on the range, select Format cells

from the short-cut menu, a Format cells window appears on the screen.

iii. Select the Alignment tab and choose proper alignment from the category list box.

iv. Click on OK.

c) To Center the spreadsheet headings across the spreadsheet.

Select the range A1:j1 then choose Home AlignmentMerge & Center.

d) Create a formula to compute the Total marks and copy this to all the cells.

i. Enter the formula into cell G3.

= SUM (C3:F3)

ii. Copy the formula (=SUM (C3:F3)) to cells from G4 to G12.

Page 46: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 39 | P a g e

e) Create a formula to compute Percentage and copy this to all the cells.

i. Enter the formula into cell H3.

= AVERAGE (C3:F3)

ii. Copy the formula (= AVERAGE (C3:F3)) to cells from H4 to H12.

f) Create a formula to compute the highest and lowest score using a library function.

i. Enter the formula into cell I3.

= MAX (C3:F3)

ii. Copy the formula (= MAX (C3:F3)) to cells from I4 TO I12.

iii. Enter the formula into cell J3.

= MIN (C3:F3)

iv. Copy the formula (= MIN (C3:F3)) to cells from J4 TO J12.

g) To draw a bar graph for Register Number against total marks.

i. Select the range of cells containing the data that you want to display in a chart. G3:G12

ii. Select the chart type form the Insert Charts Bar.

iii. Adding Chart Title: Layout Labels Chart Title.

iv. Adding Axes Title: Layout Labels Axes Title.

a. X-Axis Title: Register Number

b. Y-Axis Title: Total Marks

v. Change Legend Series Name:

a. To add series name, choose Design Select Data. Select the series name and click

the edit button. In Edit Series Dialog box, type the series name as Total Marks.

b. To add register numbers to the chart choose Design Select Data. To Select Axis

label range, click on the cell A1 and drag the cell pointer to A12.

Page 47: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 40 | P a g e

j) To Draw Pie chart for one student showing his marks in different subject from total

score.

i. Select the range of cells containing the data that you want to display in a chart. C3:E3

ii. Select the chart type form the Insert Charts Pie.

iii. Select the appropriate chart title and other chart components.

0 100 200 300 400 500

101

102

103

104

105

106

107

108

109

110

Total Marks

Regi

ster

Num

ber

Total Marks

Total Marks

89

9888

91

Shruthi

Subject1 Marks

Subject2 Marks

Subject3 Marks

Subject4 Marks

Page 48: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 41 | P a g e

PROGRAM 4:

A housewife maintains the budget expenditure in a spreadsheet under the headings

Income and Expenses. Income includes husband’s and Wife’s income separately under

different headings. Expenses include Rent, Bills, Household expenses and medical expenses.

Budget for the MonthIncome Expenses Total

Expenditure SavingsHusband Wife Rent Bills Household Medical

a) Type the Income and Expenses data for the entire month in the spreadsheet.

b) Format all numbers as currency.

c) Center the spreadsheet headings across the spreadsheet.

d) Create a formula to compute the Total expenditure and copy this to all the cells.

e) Create a formula to compute the savings and copy this to all the cells.

f) Draw a bar graph to show expenditure under each heading.

g) Draw Pie chart to show the distribution of salary.

Solution: Click on Start ProgramsMicrosoft OfficeMicrosoft Office Excel 2007.

This will open a new excel workbook displaying a blank Excel worksheet.

a) To Type the Day Number, Husband and wife salaries, expenses for 7 days in the

spreadsheet.

Now enter 7 days income the expenses data in the worksheet.

b) To Format all numbers as a currency.

i. Select the range B4:111

ii. Home cells Format Format Cells or Right click on the range, select Format cells

from the short-cut menu, a Format cells window appears on the screen.

iii. Select the Number tab and choose proper Currency from the category list box.

iv. Click on OK.

c) To Center the spreadsheet headings across the spreadsheet.

Select the range A1:I1 then choose Home AlignmentMerge & Center.

d) Create a formula to compute the Total expenditure and copy this to all the cells.

i. Enter the formula into cell H3.

=SUM (D4:G4)

This formula gives you the expenses of the Day 1.

Page 49: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 42 | P a g e

ii. Copy the formula (=SUM (D4:G4)) to cells from H5 to H10.

iii. Enter the formula into cell B11

=SUM (B4:B10)

iv. Copy the formula (=SUM (B4:B10)) to cells from C11 to H11.

e) Create a formula to compute the savings and copy this to all the cells.

i. Enter the formula into cell I11.

= B11 +C11-H11

ii. Copy the formula (= C3 * 12%) to cells from E4 TO E12.

f) Create a formula to compute Total salary and copy this to all the cells.

i. Enter the formula into cell G3.

= C3 + D3 + E3 – F3

g) To draw a column graph to show expenditure under each heading.

i. Select the range of cells containing the data that you want to display in a chart. D4:G10

ii. Select the chart type form the Insert Charts Column.

Rs. 0.00

Rs. 1,000.00

Rs. 2,000.00

Rs. 3,000.00

Rs. 4,000.00

Rs. 5,000.00

Rs. 6,000.00

Rs. 7,000.00

Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7

Rent

Bills

Household

Medical

Page 50: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

Spreadsheet Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 43 | P a g e

h) Draw Pie chart to show the distribution of salary.

i. Select the range of cells containing the data that you want to display in a chart.

Range 1 is D11:G11 and to select Range 2 hold the Ctrl Key and click on the cell I11

ii. Select the chart type form the Insert Charts Pie.

iii. Select the appropriate chart title and other chart components.

Rent10%

Bills10%

Household7%

Medical3%

Savings70%

DISTRIBUTION OF MONTHLY SALARY

Rent Bills Household Medical Savings

Page 51: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

SECTION – C

HTML

Page 52: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

HTML Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 44 | P a g e

PROGRAM 1:

Create a web page to display your details using different tags.

<HTML>

<HEAD>

<TITLE> 1ST PUC CS STUDENTS </TITLE>

</HEAD>

<BODY BGCOLOR=ORANGE>

<FONT COLOR=RED>

<H1> <CENTER> FIRST PUC COMPUTER SCIENCE BOOK</CENTER> </H1>

</FONT>

<IMG SRC = "C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg" ALIGN=LEFT

WIDTH=200 HEIGHT=300 BORDER=1>

<P> <I> COMPUTER SCIENCE </I> with C++ is a major subject at PUC level with an aim of

creating Computer-qualified graduates later on. This subject focuses on concepts of <B> computer

Fundamentals, Programming Methodology, and Programming in C++, OOP’s, Word Processor, Electronic

Spread Sheet, and Web Programming. </B> </P>

</P> This text book promises to guide you for the preparation of any exam on these topics. This book covers

the manual which are worked on with the samples. </P>

<FONT FACE= CAMBRIA COLOR=YELLOW>

<H2>SAILENT FEATURES</H2>

</FONT>

<OL>

<LI> Computer Fundamentals</LI>

<LI> Programming Methodology</LI>

<LI> Data Representation</LI>

<LI> Programming in C++</LI>

<LI> Word Processor</LI>

<LI> Electronic Spread Sheet</LI>

<LI> Web Programming</LI>

</OL>

</BODY>

</HTML>

Page 53: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

HTML Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 45 | P a g e

OUTPUT:

Page 54: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

HTML Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 46 | P a g e

PROGRAM 2:

Create a MODEL Web site for your college making using different tags.

Filename: Introduction.htm

<HTML>

<HEAD>

<TITLE> MDRPUC HASSAN </TITLE>

</HEAD>

<BODY BGCOLOR=ORANGE>

<FONT COLOR=RED>

<CENTER>

<H4> GOVERNMENT OF KARNATAKA </H4>

<H1> MORARJI DESAI RESIDENTIAL PU SCIENCE COLLEGE </H1>

<H3> GUDDENAHALLI, BELUR ROAD, HASSAN-573201 </H3>

</CENTER>

</FONT>

<IMG SRC = "C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg" ALIGN=LEFT

WIDTH=200 HEIGHT=300 BORDER=1>

<FONT FACE=CAMBRIA SIZE=06 COLOR=CYAN>

<P> MDRPU COLLEGE, Hassan most prestigious institutions in Karnataka. <BR /> Has been a

pioneer in the field of education for many years, Excellency in imparting quality knowledge. </P>

<P> Click on one of the following to get additional information </P>

</FONT>

<A HREF=”D:\COURSE.HTM” TITLE=”COURSES”> COURSES OFFERED </A> <BR> <BR>

<Marquee Direction=”Right”> Admission for the Eligible Students </Marquee>

</BODY>

</HTML>

Filename: Course.htm

<HTML>

<HEAD>

<TITLE> MDRPUC HASSAN- COURSES INFORMATION</TITLE>

</HEAD>

<BODY >

<H1><CENTER> COURSES OFFERED </CENTER></H1>

<P>

<FONT FACE=VERDANA SIZE=4 COLOR=BLUE>

<B> Part-I is Compulsory for all Students </B> <BR>

<B> Language 1- Kannada </B> <BR>

Page 55: COMPUTER SCIENCE (PCMC)...2016/10/01  · C++ Manual I PUC (PCMC’s) Morarji Desai Residential Pre-University Science College, Dudda 1 | P a g e PROGRAM 1(a): Write a C++ program

HTML Manual I PUC (PCMC’s)

Morarji Desai Residential Pre-University Science College, Dudda 47 | P a g e

<B> Language 2 – English </B> <BR> <BR>

</FONT>

<FONT FACE=TIMES NEW ROMAN SIZE=4 COLOR=RED>

<B>SCIENCE</B><BR>

<B> PCMB - </B> Physics, Chemistry, Mathematics, Biology <BR>

<B> PCMC - </B> Physics, Chemistry, Mathematics, Computer Science<BR>

<B> PCME - </B> Physics, Chemistry, Mathematics, Electronics <BR>

</FONT>

<Marquee Direction=”Left”> <B> Medium of Instruction - English </B> </Marquee>

</BODY>

</HTML>

OUTPUT