Questions: 1 978

Answers by our Experts: 1 850

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

Create a function which receives a pointer of array as a parameter and calculates the sum of prime

numbers and sum of non_prime numbers in that array. Then compares them to find out which one is

larger (sum of prime or sum of non_prime). Return both sum of prime and sum of non_prime numbers

also and print those in the main function.


Create a function to compare the elements of 2 arrays. Function should receive two pointers to an array

and then check if the elements are same in both arrays or not. If both arrays are same return true,

otherwise false.


Suppose you want to send a message to your friend but don’t want others to understand that message.

So, you have decided to encrypt the message.

Now, suppose the message is in a string variable called MSG. a) You have to encrypt the message and

change the string so that others cannot understand it. b) Again, decrypt the encrypted message.


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.

Slowly But Surely

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:

  1. In the code editor, you are provided with a main() function that asks the user for two integers and calls the slowDisplay() function.
  2. This slowDisplay() function is a recursive function which should perform the functionality explained in the problem description above.
  3. This function is only partially implemented as it lacks a base case. Your task is to add the base case needed by this recursive function.


Input


1. Starting integer

2. Number of integers

Output


Enter·starting·integer:·2
Enter·how·many·next·integers:·3
3·4·5




Write a program in C to find out the frequency of elements in an array

HALINDROME Given string S. Let us divide S to two equal parts S1 and S2. S is called halindrome if atleast any one of the following condition satisfy. a) String S is palindrom and length of S >=2 b) String S1 is halindrom. c) String s2 is halindrom. In case of odd length string, the middle element is not present in both S1 and S2. If index of middle element is M, then S1 is equal to S[0,m-1] and S2 = S[m+1, |S|- 1].

Input Specification

Input1: No. of strings. 1<= Input1 <=100

Output Specification find whether string is halindrome.

A string is Halindrom if any one of the criteria is correct .

a) String S is palindrom and its length is >=2

b) String S1 is halindrom.

c) String s2 is halindrom. if string length of S is odd then center letter is ignored and S1 is [0, len/2 -1] and S2 is [len/2+1, len-1]


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


A patient with first stage zombie virus has escaped from the facility in a city of population N. The zombie virus is very dangerous as it passes on to othr people as they come in contact with the patient makin them a petient as well. Zombie virus has K life stages to develop, each of which takes 1 unit of time. Only the last stage is contagious. A person with zombie attack only healthy people and can oly affect one person in 1 unit of time. If the patient escaped on day 1, find out the number of days it will take to wipe out the entire city's healthy population and turn them into a last stage zombie. Note: 1 unit of time is equal to 1 day.

i/p1: Total healthy population of the city

i/p2: No. of stages of zombie virus.

Ex1

i/p1:10

i/p2:1

o/p:5

Hence, on day2, the affected population will be 2 and so on. On day 5, the affected population will be 16 which is bigger than 10. Ex2

i/p1:10

i/p2:2

o/p:6 It takes 2 days for virus to evolve.


Diana proposed an algorithm for parsing complex mathematical expressionsspecified in an infix notation is one where an operator is present between two operandse.g.(2+5.This algorithm is also used in compiler creation in the parsing phase to generate abstract syntax treeand postfix notations.The algorithm also involves parsing expressions including parenthess and power operations.the algorithm is basically,stack based.

It is a simple example of shunting yard algorithm:

input:3+4 Add 3 to the output queue(whenever a number is read,it is add to the output).push ‘+’ onto the operator stack .Add 4 to the output queue.After readind the expression ,pop the operators off the stack and add them to the output. In these case,there only one operator,’+’.The resulting postfix notation is ‘34+’.

Your friend has requested you to help him in implementing this algorithm as he has to solve large mathmatical expressions given in infix notations

Note:the characters in the input are seperated by spaces

Ex :

i/p1:10+2*6

o/p:22


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS