Question
Question 1. Ned mistakenly teleports Spider-Man and MJ in two different places along the route from Jatrabari to NSU. Spider-Man is trying to reach MJ
Question 1. Ned mistakenly teleports Spider-Man and MJ in two different places along the route from Jatrabari to NSU. Spider-Man is trying to reach MJ using his web swings and, in each swing, he can travel only 150 meters. He only has an array in his mobile called distance[5] that holds the distances[in meters] between places in the Jatrabari to NSU route. The array looks like this-
Array | Description |
A[0] = 5000 | Distance between Jatrabari & Kamalapur. |
A[1] = 7000 | Distance between Kamalapur & Mouchak. |
A[2] = 3000 | Distance between Mouchak & Rampura. |
A[3] = 2000 | Distance between Rampura & Badda. |
A[4] = 4000 | Distance between Badda & NSU. |
Now its your time to help our friendly neighborhood Spider-Man. Write a C program to take Spider-Mans position and MJs position as input and calculate the distance between & the number of swings he will need to reach MJ.
Sample Input
Enter position of Spider-Man: Mouchak Enter position of MJ: NSU
Sample Output
Distance: 9000 meters Swings needed: 60
[Hint: In the sample the distance from Mouchak to NSU is calculated as (Mouchak to Rampura 3000+ Rampura to Badda 2000+ Badda to NSU 4000) = 9000 meters]
Question 2. Suppose you have recently started to like a person and you are trying to get familiar with the person through chatting. In order to impress him/her during the chatting, you decided to write the messages in the Alternating Caps. To make this easier for you, write a C program that takes a string input from the user and converts the string into Alternating Caps.
Sample Input
Enter a String: Alternating Caps
Sample Output
AlTeRnAtInG CaPs
Question 3: Write a C program to print the following Christmas tree pattern to wish your friends a happy Christmas.
[Hint: The Christmas tree consists of a full triangle followed by a half triangle and a rectangle]
4. While playing a game called Random Number, you noticed that some numbers remain the same despite you read their digits forward or backward and you found that these numbers are called palindrome. You also learn that a palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as 5115 or 71717.
Write a user-defined function void checkPalindrome(int n) that determines if a number is palindrome. Continue taking input numbers and check for palindrome until user gives 0 as input.
Sample Input
Enter a number: 3223
Sample Output
It is a palindrome number. Enter a number:
Sample Input
3234
Sample Output
It is not a palindrome number. Enter a number:
Sample Input
0
Sample Output
End of program.
Question 5: After a fantastic lab final you have come to see a cricket match of Bangladesh to lighten your mind. But the scorekeeper is missing and BCB gave you the responsibility to keep the score record of the players using a C program. Now you have to define a structure to hold the players' names and the run they scored in the cricket match. Then you have to store the top five players' names and run they scored in the match. At the end of the match, you will have to print all the players' name and their scores who scored more runs above the average among them. Write a C program to complete the above tasks.
Sample Input
Player 1 Name: Tamim Iqbal Player 1 Runs: 35 Player 2 Name: Shakib Al Hasan Player 2 Runs: 49 Player 3 Name: Soumya Sarkar Player 3 Runs: 5 Player 4 Name: Mushfiqur Rahim Player 4 Runs: 23 Player 5 Name: Liton Das Player 5 Runs: 17
Sample Output
Players with more than average runs: Tamim Iqbal, Runs: 35 Shakib Al Hasan, Runs: 49
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started