Questions: 1 680

Answers by our Experts: 1 680

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

1. Return types and basic algorithms

I. Write a program to find the sum of 10 integer numbers inside a separate function called sum() and print the total inside the main function.

II. Improve the above program to find even numbers in a given array.

III. Which parts of the above program (a) needs to be changed to code linear search?


Your task is to develop a circular linked-list based simulation of the Josephus problem. The simulation will be text based. The user should be presented with a text-based menu asking him to enter the total number of people (n), starting point (i), direction (clockwise/anti-clockwise) and number to be skipped (k). Your program then must populate a circular linked list with n nodes where data of each node should be their position in the circle (starting from 1).Your program should then work iteratively printing the remaining persons after each iteration (round of killing). After the last iteration only the node with the winning initial position should be left in the list. Example:


• For n =15


• k = 2


• starting point (i) = 1


• direction = clockwise


Initial scenario:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


After1st iteration: 1 3 5 7 9 11 13 15


After2nd iteration: 3 7 11 15


After3rd iteration: 7 15


After4th iteration: 15 (15 remains in the end). Program ends.

In the situation where there are multiple users or a networked computer system, you probably share a printer with other users. When you request to print a file, your request is added to the print buffer. When your request reaches the front of the print buffer, your file is printed. This ensures that only one person at a time has access to the printer and that this access is given on a first-come, first-served basis. Write a C program to implement the above scenario.


Arjun wants to count total number of digits of an Integer number (N). Help him to generate the program using do while loop.



As a safety precaution banks provide a feature that during any ATM transaction if someone comes and attacks, then the customer can enter the ATM pin in reverse order. This sends a message to the nearest police station. However if the reversed pin is the same as he original pin then no alarm is created. The bank needs a software application that checks that a user chooses an ATM pin whose reverse is not the same number. A software need to be developed with following requirements using while loop.

a. Read the pin number

b. Calculate the reverse the pin number

c. if the reversed pin is same as original pin then inform the user that this is an invalid pin number


In a box of total area 10000cm3, Mr. Varun has to pack the balls of given radius “r” and all the balls have the same volume, Help Mr. Varun to find the total number of balls that he can pack in the given box.

Requirements

Capture the radius of the ball “r”

Compute the volume (Hint: Volume=4/3πr3)

Calculate how many number of balls can be placed in the box of 10000cm3 box

Display the number of balls packed by Mr. Varun


As many of the students like chats, chips, juice and chocolates, a vending machine is kept at several places. The person after putting the cash has to enter the product code so as to get it.

The code is as follows

Code Product

106 Haldiram Ratmali Sev

206 Haldiram Instant Bhel

306 Fuse Chocolate

406 Mixed Fruit Juice

506 Lassi

Depending on the code entered the item will be selected and given to the person who feeds the amount.An application has to be developed so that it automatically works after entering the code.

Requirements:

1. Capture the Code

2. Check the code with the existing code and display appropriate product selected

3. If the code is entered wrong it has to display money lost


Peter runs a vehicle rental center. The vehicles are of three types, MICRO, MINI and SUV. The customer who travels in MICRO will pay Rs 15 per kilometer. The customer who travels in MINI will pay Rs 20 per kilometer and the customer who travels in SUV will pay Rs 25 per kilometer.

A software need to be developed to compute the cost of travelling by the customer with following requirements.

a. The distance travelled by customer need to be captured.

b. The type of vehicle to be captured (M for Micro, m for mini, S for SUV).

c. Check the type of vehicle.

d. Compute the final cost of the travel depending on the vehicle.

Display the final cost.


write a program in c to add two polynomials with n number of variables


What would be the output of the following program? Explain.

i n t main ( )

{

p i d t pid 1 ;

p r i n t f ( ‘ ‘ b e f o r e f o r k ( ) ’ ’ ) ;

i f ( ( pid 1=f o r k ()) >0)

{

w ai t pi d ( pid1 , NULL, 0 ) ;

}

e l s e i f ( pid 1 == 0 ) {

e x e c l ( ‘ ‘ / u s r / bin / bash ’ ’ , ‘ ‘ bash ’ ’ ,NULL ) ;

p r i n t f ( ‘ ‘ done l a u n c hi n g the s h e l l ’ ’ ) ;

}

e l s e {

p e r r o r ( ‘ ‘ f o r k ( ) ’ ’ ) ;

}

}

What to submit:

• Write-up describing an explanation for the output (i.e. why you observe

what you observe).


LATEST TUTORIALS
APPROVED BY CLIENTS