Write a menu driven program which has the following options:
1. Factorial of a number
2. Prime or not
3. Odd or Even
4. Exit
Once a menu item is selected the appropriate action should be taken and once
this action is finished, the menu should reappear. Unless the user selects the “Exit”
option the program should continue to work. You may use of an infinite while and
switch statement.
Make a program that prints out the first 8 multiples of a given integer y. Please use
for loop.
Sample output:
Enter a number: 7
7 14 21 28 35 42 49 56
While purchasing certain items, a discount of 10% is offered if the quantity
purchased is more than 1000. If quantity and price per item are input through the
keyboard, write a program and a flowchart to calculate the total expenses.
Write a c program to check if a given number is a prime or not
Write a program to printout even numbers from 1-1000
Write a program to find the sum of array elements
You are given an array of N non-negative integers: A1, A2, ..., AN. An alternating subsequence is a subsequence in which the indices of any two consecutive elements differ by exactly two in the original array. That is, if Ai1, Ai2, ..., Aik is some subsequence, then for it to be an alternating subsequence, (i2 - i1 = 2), (i3 - i2 = 2), and so on should all hold true. Among all alternating subsequences, find the one which has maximum sum of elements, and output that sum.
An e-commerce company plans to give their customers a discount for the New Years holiday. The discount will be calculated on the basis of the bill amount of the order placed. The discount amount is the product of the sum of all odd digits and the sum of all even digits of the customer’s total bill amount.
Write an algorithm to find the discount amount for the given total bill amount.
Sample Input
billamount = 2514795
Sample Output
Output = 34
write a c program to print the prime numbers in a singly linked list
Samuel owns a shoe factory where there are N different machines operated for N different purposes. Each machine has its own motor. In order to avoid resonance, the rotation speed of any 2 machines should at least differ by 2 units. The rotation speed can only be in integer units and the maximum rotation speed of any motor is X units. Given minimum rotation speed of any motor to be 1 unit, you have to help Sam find out the number of different ways he can configure the speed of the motor. Input Specification: input1: N, denoting the number of machines. input 2X, denoting the maximum speed of the motor. Output Specification: Your function should return the total number of configuration modulus 10^4.