Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Q1.

Write a user defined function to add 2


numbers and display their sum.

RESULT:-
Q2.Write a program using a user defined function
that displays sum of first n natural numbers,
where n is passed as an argument.

RESULT:-

Q3. Write a program using a user defined


function calcFact() to calculate and display the
factorial of a number num passed as an argument.

RESULT:-
Q4. Write a program using user defined
function that accepts length and breadth of a
rectangle and returns the area and perimeter of
the rectangle.

RESULT:-
Q5. Write a program to copy the entire content
from the file data.txt to story.txt.

RESULT:-

Q6. Write a program to read the entire content


from the file data.txt and copy only those words to
story.txt which starts from vowel.
RESULT:-
Q7. Write a program to read file data.txt and
copy only those lines to story.txt which are
starting from alphabets “A” or “T”.

RESULT:-
Q8.Write a program to count only those lines
from text.txt which are starting from
alphabets “T” or “M”

RESULT:-
Q9.Write a program to read the content
from the file file.txt and display all
numbers.
Q10.Write a menu driven program which
shows all operations on (a)binary file
(b)Add Record
(c)Display all Record
d)Display specific Record

You might also like