Flipkart is providing a discount to customers based on the purchases made. Ramachandra has
purchased some items, he would like to know his bill. Following are the requirements to solve
the problem
a) For purchases less than Rs 1000 , the discount is 10%
b) For purchases greater than and equal to Rs 1000 and less than 1500
the discount is 12%
c) For purchases greater than and equal to Rs 1500 the discount is 14%
d) Capture the purchased amount by Ramachandra
e) Display Ramachandra’s final bill
Write a C program to compute the Maclaurin Series expansion of 𝑓(𝑥) = cos 𝑥.
You need to add the terms in the Maclaurin series until the percent relative error falls below a certain pre-specified relative error (%).
Inputs to your program will be x (in radians)) and the pre-specified relative error (%).
Your program should print the number of terms, cos x value obtained along with the true, absolute, and relative approximate errors (%).
Your program needs to get the true value of 𝑓(𝑥) = cos 𝑥 using the built-in cos 𝑥 function in C\C++.
Sample output:
Enter your approx. relative error bound:
0.001
Enter your angle in radians:
1.04719
N.terms Exact aproximate value absolute error relative error
1 0.500007 0.451697 0.048310 9.661871
2 0.500007 0.501803 0.001796 0.359220
......................
1.Write a program to find largest number among three number. Also, design flowchart of the program.
Computer Science
Write a program to control a set of 10 motors; the motors are operating under load balancing mechanism as
follows:
• Motors operate in pairs as follows: 1,10 then 2, 9 then 3,8 then 4,7 then 5,6 then repeat.
• The operating duration for each pair is 10,000 milliseconds.
• After each operating cycle, all motors must be OFF for 10,000 milliseconds then a new cycle starts.
• The operating sequence is running 24/7.
The company XYZ is offering painting services.
The cost for painting each window is 200 Rs.
The cost for painting each door is 500 Rs.
The company charges 33 Rs per square feet.
Additional service charges are 500 Rs per room.
To calculate the square feet of a room that is rectangular or square,
simply multiply the length of the room by the width.
Write a C program to calculate the painting cost of your room.
Requirements:
1. Capture length and width of the room.
2. Capture number of windows in room from user
3. Capture number of doors in room from user
4. Compute area of room in square feet.
5. Display area of room(sqft).
5. Compute painting cost with suitable expression.
6. Display painting cost.
Write a program to read a positive integer number 'n' and generate the numbers in the [5 M] following way. If entered number is 3, the output will be as follows:
9 4 1 0 1 2 3
I'm having trouble solving a c problem using graphs. I must solve it two times, one using adjacency matrix and another using adjacency list. If you guys can help me, I appreciate it! Here's the problem:
"Operating systems are large software artifacts made up of many packages.The installing of each package may require that other packages are already installed. Given a list of packages and a list of dependencies between packages,determine the number of dependents, the number of dependencies and the list of dependencies of each package."
Input:
"The first input line contains two integers separated by a blank space. The first one, N (1 ≤ N ≤ 100), is the number of packages from the operating system, which are identified by integers 1, 2,. . . , N. The second one, D (0 ≤ D ≤ 10000), is the number of dependency relations between packages. The next D lines contain the specification of the packages dependencies, each consisting of two integers ui and v , such that 1 ≤ ui, vi ≤ N, for 1 ≤ i ≤ D. The dependency specification means that installing the ui package requires prior installation of the v package. You can assume that there is no circular dependency."
Output:
"The output must consist of information about the packages and their dependencies. Each package (numbered from 1 to N) must appear immediately followed by two separate integers separeted by a space, indicating its number of dependents and dependencies, respectively. If there is at least one dependency, these two numbers must be followed by a space and then a list of the package numbers that need to be installed before it, where each package number is separated from other package numbers by a space. Do not put spaces to the right at the end of each line. There must be an exit line for each package of the operating system and, therefore, a total of N output lines."
Example(input and output lines):
4 3 (number of packages and number of dependencies) / 1 2 (package 1 depends on package 2) / 1 3 (package 1 depends on package 3) / 4 2 (package 4 depends on package 2) / 1 0 2 2 3 (information about package 1 and its dependencies) / 2 2 0 (information about package 2 and its dependencies) / 3 1 0 (information about package 3 and its dependencies) / 4 0 1 2 (information about package 4 and its dependencies)
You have got homework in N subjects for each homework you require a minimum of min energy and consume actual energy while doing it.
Example, if for a other home work mini=12 and actuality=10, you require at least 12 energy for starting this homework. If u have 11 energy or less you cannot do this homework.
Calculate the minimum intial energy required to complete all the homework
Note : you can finish the homework in any order you like
Constraints
1<=N<=10^5
1<=actual [i]<=10^3
1<=min[I]<=10^3
Write a program to convert kilogram to gram and pound.
● Declare an array as a global variable, called kilo with 4 elements.
● In main():
▪ Call function get_input().
▪ Call function convert_gram().
▪ Call function convert_pound().
● In get_input():
Using for loop, prompt the user to input the values in kilogram and store them in the
array kilo.
● In convert_gram():
▪ Use for loop to convert the values in grams and display the values.
▪ Formula: 1 kg = 1000 g
● In convert_pound():
▪ Use for loop to convert the values in pounds and display the values.
▪ Formula: 1 kg = 2.205 pounds
Question 1
You are given a deck containing N cards. While holding the deck facedown: 1. Deal all the cards facedown onto a table into Y piles like you would if you were playing with a group of people (i.e. card 1 to P1, card 2 to P2, ..., card Y to PY, card Y + 1 to P1, etc). 2. Combine all the piles into a deck by placing P1 onto P2, then P1+P2 onto P3, and so on. This is a round. 3. Pick up the deck from the table and repeat steps 1-2 until the deck is in the original order. 4. For each round, vary the pile count according to a repeating pattern. Start with 3 piles, then 4, then 5, then loop back to 3, then 4 and so on.
* Write a program to determine how many rounds it will take to put a deck back into the original order. This will involve creating a data structure to represent the order of the cards. Do not use an array. This program should be written in C only. It should take a number of cards in the deck as a command line argument and write the result to stdout. Please ensure the program compiles and runs correctly (no pseudo-code). This isn't a trick question; it should be fairly straightforward. Bonus: Output how many rounds should be completed before the deck is adequately shuffled from the original deck for a person who is casually playing a game with cards. Provide your methodology in a comment block.