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

Computer Programming teacher conducts test for 20 marks for 10 students. Teacher wants to know the average marks scored by the students.



Following are requirements to solve the problem



Teacher should have capture the marks scored by the student.



Teacher should compute the average marks scored by the students.



Teacher should display the average marks scored by the students.



Computer Programming teacher conducts test for 20 marks for 10 students. Teacher wants to know the average marks scored by the students.




You are requested to write a program which will be used to take the entry test for university


students. The program must have following features.


• For correct answer, students get 4 marks.


• For wrong answer, student lose 1 mark.


• If the student answers first four questions wrong exit the program with a message “Sorry,


you did not qualify for the admission.”


• If students score 20 marks, program should display “Congratulations, you have qualified for


the admission “and exit.


• There will be only 4 options for each question

Rahul wants to find the cube of integers. Help him to develop a program in C to display the

cube of the number up to given an integer using for loop


Computer Programming teacher conducts test for 20 marks for 10 students. Teacher wants to know the average marks scored by the students.


Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".

Let's try this out now!


Input

A line containing two integers separated by a space.

777·7

Output

A line containing a string.

Jackpot!

Implement BST and its operations.


.4. • Enter the code

// Function prototype. Some compilers absolutely insist that function
// prototype(s) are present
void blah2(int *i);


// ===========================================================
// Function blah2()
//
// This takes a reference to a value i, increments it and displays it
//
// Returns the calculated voltage.
// ===========================================================

void blah2(int *i)
{
    printf("In function: the value of *i is %d\n", *i);
    (*i)++;  // Equivalent to *i = *i + 1;
    printf("In function: the value of *i after increment is %d\n\n", *i);
}


int main(int argc, char *argv[]) {
    int num;
    
    num = 3;
    blah2(&num);
    
    printf("In main(): the value of num is %d\n", num);

    system("pause");
	return 0;
}


• Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code. Also, comment on the difference between passing parameters to a function by reference and by value.





Using loops and condition statements together, Write a program that calculate the cost of energy for energy units restricted between 0 to 500 kWh for an amount less than $6 000.00 for any Zimbabwean resident customer and any amount and unlimited number of units for a foreign resident customer buying from outside Zimbabwe at a rate of $90.00 to one USD. The tariffs are as follows:








• 0 to 50 kWh cost $2.25








• Above 50 kWh to 100 kWh cost $4.51 / kWh








• Above 100kWh to 200 kWh cost $7.89 / kWh








• Above 200kWh to 300 kWh cost $11.25 / kWh








• Above 300kWh to 400 kWh cost $12.94 / kWh








• Above 400 kWh cost $13.50 / kWh

5.3

Enter the code

void blah(int i)
{
    printf("In function: the value of i is %d\n", i);
    i++;
    printf("In function: the value of i after increment is %d\n\n", i);
}


int main(int argc, char *argv[]) {
    int num;
    
    num = 3;
    blah(num);
    
    printf("In main(): the value of num is %d\n", num);

    system("pause");
	return 0;
}


• Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.


1.6) Enter the code

void Hello()
{
    printf("Hello world\n");
}


int main(int argc, char *argv[])
{    
    Hello();

    system("pause");
	return 0;
}


Add the output of this program to your logbook

• You should be able to appreciate that functions can be used to prevent code duplication. Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS