Question: (5marks) Q1: Write a program to extract the first N characters of a string. Your program will have to do the following: Initialize char str[100],

(5marks) Q1: Write a program to extract the first N characters of a string. Your program will have to do the following: Initialize char str[100], substr[100] Apply while loop to traverse to the location till nth position Use of gets and puts SAMPLE TEST OUTPUT: Enter the string:ASSIGNMENT 2 Enter the number of characters to be copie from left: 6 Do not use the same string. This is just Example The substring is ASSIGN Process exited after 11.92 seconds with return value @ Press any key to continue Q2: Write a program to add two distances in inch-feet system using structures: (5mark (For reference: 12 inches is 1 foot) Your program will have to do the following: Use structure name DISTANCE, variables names distl and dist2 and store the sum in Result Add feet to feet and inches to inches Use while loop to deal with inches whose value is more than 12. SAMPLE TEST OUTPUT: Enter ist distance Enter feet: 8 Enter inch: 10 Enter 2nd distance Enter feet: 2 Enter inch: 7 Do not use the same values. This is just Example Sum of distances - 11'-5.6" Process exited after 13.91 seconds with return value @ Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
