0% found this document useful (0 votes)
3 views5 pages

2014 Iscpractical

The document outlines three programming tasks related to composite magic numbers, square matrices, and sentence manipulation. Task 1 requires finding composite magic integers within a specified range, Task 2 involves matrix operations including symmetry checking and diagonal sums, and Task 3 focuses on processing a sentence to manage spacing and word deletion. Each task includes input validation and examples for clarity.

Uploaded by

Ashish Rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

2014 Iscpractical

The document outlines three programming tasks related to composite magic numbers, square matrices, and sentence manipulation. Task 1 requires finding composite magic integers within a specified range, Task 2 involves matrix operations including symmetry checking and diagonal sums, and Task 3 focuses on processing a sentence to manage spacing and word deletion. Each task includes input validation and examples for clarity.

Uploaded by

Ashish Rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ISC Computer Science Practical

Paper 2
2014
Question 1
A Composite Magic number is a positive integer which is composite as well as a magic number.

Composite number : A composite number is a number which has more than 2 factors.
For example :- 10
Factors are : 1,2,5,10.

Magic number : A magic number is a number in which the eventual sum of the
digits is equal to 1.
For example:- 28 = 2+ 8 =10 = 1+0=1

Accept 2 positive integers m and n, where m is less than n as user input. Display the number of
composite magic integers that are in the range between m and n (both inclusive) and output them
along with the frequency, in the format specified below.

Test your program with the sample data and some random data:

Example 1:
INPUT: m=10
n=100

OUTPUT:
THE COMPOSITE MAGIC INTEGERS ARE :
10,28,46,55,64,82,91,100
FREQUENCY OF COMPOSITE MAGIC INTEGERS IS :8

Example 2:
INPUT: m=1200
n=1300

OUTPUT:
THE COMPOSITE MAGIC INTEGERS ARE :
1207,1216,1225,1234,1243,1252,1261,1270,1288
FREQUENCY OF COMPOSITE MAGIC INTEGERS IS :9

Example 3:
INPUT: m=120
n=99

OUTPUT:
INVALID INPUT

Question 2.
Write a program to declare a square matrix A[][] of order MxM where ‘M’ is the number of rows
and the number of columns, such that M must be greater than 2 and less than 10. Accept the value
of M as user input. Display an appropriate message for an invalid input. Allow the user to input
integers into this matrix. Perform the following tasks:

a) Display the original matrix.


b) Check if the given matrix is symmetric or not. A square matrix is said to be symmetric, if
the element in the ith row and jth column is equal to the element of the jth row and ith
column.
c) Find the sum of the elements of left diagonal and the sum of the elements of right diagonal
of the matrix and display them.

Test your program for the following data and some random data:

Example 1
INPUT: M= 3
1 2 3
2 4 5
3 5 6

OUTPUT:
ORIGINAL MATRIX
1 2 3
2 4 5
3 5 6
THE GIVEN MATRIX IS SYMMETRIC
The sum of the left diagonal = 11
The sum of the right diagonal = 10

Example 2
INPUT: M= 4
7 8 9 2
4 5 6 3
8 5 3 1
7 6 4 2

OUTPUT:
ORIGINAL MATRIX

7 8 9 2
4 5 6 3
8 5 3 1
7 6 4 2

THE GIVEN MATRIX IS NOT SYMMETRIC


The sum of the left diagonal = 17
The sum of the right diagonal = 20

Example 3
INPUT: M= 12

OUTPUT:

THE MATRIX SIZE IS OUT OF RANGE

Question 3.
Write a program to accept a sentence which may be terminated by either ‘.’, ‘?’ or ‘!’ only. Any
other character may be ignored. The words may be separated by more than one blank space and are
in UPPER CASE.

Perform the following tasks:


a) Accept a sentence anduce all the extra blank space between 2 words to a single blank
space.
b) Accept a word from the user which is a part of the sentence along with its position number
and delete the word and display the sentence.

Test your program for the following data and some random data.:

Example 1
INPUT: A MORNING WALK IS A BLESSING FOR THE WHOLE DAY.

WORD TO BE DELETED : IS
WORD POSITION IN THE SENTENCE : 6

OUTPUT: A MORNING WALK IS A BLESSING FOR THE WHOLE DAY.


Example 2
INPUT: AS YOU SOW, SO SO YOU REAP.

WORD TO BE DELETED : SO
WORD POSITION IN THE SENTENCE : 4

OUTPUT: AS YOU SOW, SO YOU REAP.

Example 3
INPUT: STUDY WELL ##.

OUTPUT: INVALID INPUT.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy