VL2022230504342 Da

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Digital Assignment - 1

Course Code- BCSE102L Slot-B2


Structured and Object-Oriented Programming
Faculty-Pinisetti Akshai Kumar

#Instructions:- Write the Digital Assignment in hand written format. For


all the questions sample input and output is expected. Take picture, make it
as a soft copy (PDF file) and upload it in VTop.Write your name and
Registration no. on the top. Save the file with your Registration number
before uploading .

1. Showcase Flowchart, Algorithm and Write a C program to perform Right rotation


of array elements by n positions. User provides the size of the array and the array
elements. Output format:
Enter the size of the array:
Enter the array elements:
Enter the number of Right rotations to be performed:
Array:
n positions right rotated array:

2. A company uses an array to store the salaries of their employees. Write a C


program to do the following.
(a) Declare a double array called salaries of size 5.
(b) Initialize all the array elements to -1.
(c) Input the salaries of 5 employees from the keyboard and store them in the array.
If the user input a negative value, display an error message and ask to re-enter the
salary.
Input format sample:
Input salary of employee 1: 20000.00
Input salary of employee 2: 15000.00
Input salary of employee 3: -1200
Please re-enter the amount.
Input salary of employee 3: 75000.00
………..
………..
(d) The company decided to give a 10% increment for the employees whose
salaries are below 10000.00. Update the array accordingly.
(e) Display the employee number and the new salaries in the following format.
Employee Salary
1 XXXXXX
4 XXXXXX
























3. Write a C program which takes a string as input from the user that is not less than
16 characters and not more than 20 characters without any spaces.
(a)Now count number of vowels and consonants in it and display it.
(b)Display the highest repeated vowel.
(c)Remove all the vowels and display the string.
(d)Sort the characters of the string in the lexicographical order.
Output format:
Enter a string that is not less than 16 characters and not more than 20 characters
without any spaces:
Vowels:
Consonants:
Highest repeated vowel:
String without vowels:
Lexicographical order sorted string:

4. A hotel has decided to offer 10% discounts from hotel charge for the wedding
packages during the festive season. Discount is valid only if the number of guests
is more than 200.
You are asked to write a C program to calculate the discount for the wedding
package by considering the number of guests. Two separate functions are to be
declared,
1) To compute the discount amount, if any based on the number of guests and
return to second function. (Discount is % of Total charge to be reduced.)
2) To compute the Amount to be paid after receiving the discount from the discount
function. (Amount to be paid = Total charge - Discount)
In your main function read the number of guests and the charge per guest from
keyboard and display the discount and the amount to be paid for wedding package
using the functions created above, in the following format.
Enter number of guests:
Enter charge per guest:
Discount:
Amount to be paid:

5. Showcase Flowchart, Algorithm and Write a C program to print the Fibonacci


sequence from the given start position to end position. Using 2 functions.
1) Function to take inputs from the user that returns start position to end position to
the Fibonacci sequence.
2) A recursive Fibonacci function that takes inputs from the user and prints the
sequence as per the need.
Output format:
Start position:
End position:
Sequence:

























You might also like