Make a program that allows the user to select the operation he or she wishes to perform. Furthermore, your program will keep asking the user to pick until he or she selects exit to stop the execution.
by CodeChum Admin
In life, good things take time.
Let's make a simple program that mirrors this beautiful idea where we ask the user for two integer inputs. The first one would represent the starting number and the second one would represent the next n integers after it.
For example, if the first number inputted is 2 and the second number inputted is 3, then the output would be 3, 4, 5 because these are the next 3 integers after 2.
Instructions:
Input
1. Starting integer
2. Number of integers
Output
Enter·starting·integer:·2
Enter·how·many·next·integers:·3
3·4·5Write a program in C to find out the frequency of elements in an array
ELECTROSTATICS:
Doug caught up with a rod comprising of negative(N) and positive(P) charges. He is asked to calculate the maximum net absolute value of electrostatic field possible in the region due to the rod.
Note : Assume, Electrostatic field = (absolute value of total charge) * 100;
input1 : {4,3,5}
input2 : PNP
output : (4-3+5) * 100 = 600
The principal of a school wants to speak with some of the students to assess their over all development including studies,most of the teachers were selecting the toppers of their classes but Mr,sam thought of an idea to select the bunch of students who did not have much difference in their marks so that he gains the reputation of a teacher who teaches well to the whole class and not just to a bunch of brilliant students.
Your are required to help mr,sam in selecting K students that can speak with principle from his class .you need to return an integer array representing the marks of the selected students sorted in ascending order.
I/p1:An integer value denoting the number of students in Mr.sam’s class.
I/p2:An integer array of size input1representing the marks of each student
I/p3:An integer K denoting the number of representatives to be
O/p:return an integer array containing the marks of K selected students sorted in ascending order.
Ex:
I/p1:10
I/p2:{950,477,55,602,881,302,859,438,551,382}
I/p3:1
O/pt:{950}
Harrypotter is visiting his uncle’s house ,the house of Black ,and ants to know more about the family through their ancestral tree.He notices that the ancestraltreebegins with the head of the family at the top,having 2 children as his descendants,This pattern is followed throught and each member is represented by unique integer.
Given relationships in the form ofan integer arraywhere the head of the family is at the first position (i=0) and his children areat position (2*i+1) and (2*i+2).
Your task is to help harry find and return all the siblings of any given family member and return them in the form of a sorted array.
Note:if there are no siblings ,return {-1}.
Example:
Input1:5
Input2:{1,2,3,4,5}
Input3:1
Output:{-1}
you want to buy a particular stock at its lowest price and sell it later at its highest price,since the stock market is unpredictable,you steal the price plans of a company for this stock for the next N days.
Find the best price you can get to buy this stock to achieve maximum profit.
Note:The initial price of the stock is 0.
Input1:Nnumber of days.
Input2:Array representing changing stock price for the day.
Output: Your function must return the best price to buy the stock at.
Example:
Input1:5
Input2:{-39957,-17136,35466,21820,-26711}
Output:-57093
Write a program which takes PIN number of the user as input and then verifies his pin. If pin is verified the program shall display “pin verified” and “Welcome”; otherwise, the program shall give user another chance. After 4 wrong attempts, the program shall display “Limit expired” and then exit. Use for loops to implement the logic.
Note: 5 random PIN numbers can be assumed and fed into the program with which input pin is matched
Write a program that takes marks of 10 students as input. It calculates the class average and displays it on the screen. Interaction with the program might look like this. Use while loop.
Implement the following problem in C programming language with following functions:
1- A function “Speed” that takes meters and seconds as parameters and returns the speed in meter
per second (m/s).
2- A function “Convert” that returns the kilometer per hour (kph) equivalent of m/s.
Call the above created function in main to test them.