Questions: 1 680

Answers by our Experts: 1 680

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

Write a C program that displays the following menu on the screen:

   MENU OF OPERATIONS

  By: <Your Name Here>

  [ 1 ] - Addition

  [ 2 ] - Subtraction

  [ 3 ] - Multiplication

  [ 4 ] - Division

  [ 5 ] - Modulo Division

  [ 6 ] - Quit

  Enter Your Choice:  3

  You have chosen Multiplication!

  Enter three integers: 89 78 67

  Sum = 465,114

  Thank you for using my program...

The user has to be prompted to input a number of his/her preferred operation and will then be asked to enter three integers and display the computed value based on the inputted operation. 


Create a C program that accepts 3 integers and display separately the highest and the lowest among them.


   Sample Run:


   Enter 3 integers: 36 54 45


   Highest: 54


   Lowest: 36


1.    The purpose of a sorting algorithm is to order/categorize set of items within a series of items.                                                                         

                          I.    Write a program/method to find a minimum number in an integer numbers array.         

                        II.    Write a program/method to swap two numbers in the above array when the indices are given.

                      III.    Now combine the above two methods and implement selection sort algorithm. You must call the above two methods in your sorting program.

                     IV.    Write a program/method to generate an array of random numbers.

                       V.    Now test your selection sort algorithm with a random number array.




10. Using the online compiler

(Part 8) Write a program that counts upwards from 0 to 100 using a for loop


• Modify the program of Part 8 so that it counts upwards from 0 to 100 in steps of 2.

• Add this source code to your logbook.

• Run the program and add the output of this program to your logbook.

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


9. Using the online compiler

• Write a program that counts down from 100 to 0 using a for loop.

• Add this source code to your logbook.

• Run the program and add the output of this program to your logbook.

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


5. Using the online compiler (or Dev C++):

• Enter the code

int main(int argc, char *argv[]) {
	
	int a;
	
	// Obtain the value of integer a
	printf("Enter the value of integer a: ");
	scanf("%d", &a);
	printf("\n\n");
	
	// Determine using a switch construct whether
	// a is an odd digit, even digit or multiple digits
	switch(a)
	{
	case 0:
	case 2:
	case 4:
	case 6:
	case 8:
		printf("a (%d) is an even digit\n", a);
		break;

	case 1:
	case 3:
	case 5:
	case 7:
	case 9:
		printf("a (%d) is an odd digit\n", a);
		break;
		
	default:
		printf("a (%d) contains multiple digits\n", a);
	}
	
	system("pause");
	return 0;


• Enter an ODD single digit value that is less than 10.

• Enter an EVEN single digit value that is less than 10.

• Enter a value that is greater than 10.

• Write a code on its functionality comparing the outputs against the source code.

• Modify the program In other words for a 0, the program would display “ZERO” for a 7 the program, would display “SEVEN”









4. Using the online compiler

• Enter the code


int main(int argc, char *argv[]) {
	
	int a, b;
	
	// Obtain values for a and b
	printf("Enter the value for integer a: ");
	scanf("%d", &a);
	printf("Enter the value for integer b: ");
	scanf("%d", &b);
	printf("\n\n");
	
	// Compare a and b
	if (a > b)		      // Testing for a greater than b
	{
		printf("a (%d) is bigger than b 0(%d)\n", a, b);
	}
	else if (a == b)      // Testing for equality
	{
		printf("a (%d) is equal to b (%d)\n", a, b);		
	}
	else				  // Otherwise a must be less than b
	{
		printf("a (%d) is less than b (%d)\n", a, b);		
	}
	
	system("pause");
	return 0;

• Enter a value of a that is greater than b.

• Enter a value of a that is less than b.

• Enter a value of a that is equal to b.

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

• write the message “Password correct” if the value of a is 42 AND the value of b is 216.







1. Using the online compiler

• Enter the code from the file

int main(int argc, char *argv[]) {
	float f;
	int a, b, c;
	int quotient, remainder;
	
	// Obtain integer values for a and b
	printf("Enter the value for integer a: ");
	scanf("%d", &a);
	printf("Enter the value for integer b: ");
	scanf("%d", &b);
	printf("\n\n");
	
	// Integer add, subtract, multiply, divide
	c = a + b;
	printf("%d + %d = %d\n", a, b, c);
	c = a - b;
	printf("%d - %d = %d\n", a, b, c);
	c = a * b;
	printf("%d * %d = %d\n", a, b, c);
	quotient = a / b;
	remainder = a % b;
	printf("%d / %d = %d\ r %d\n\n\n", a, b, quotient, remainder);

	// Floating point division without and without typecast.
	f = a / b;
	printf("%d / %d = %f   (a and b are integers)\n", a, b, f);
	f = (float)a / b;
	printf("%f / %d = %f   (a and b are integers but with a cast as a float)\n", (float)a, b, f);
	

 Run the program. enter integer values for Enter 4 for a, and 5 for b.











As a safety precaution banks provide a feature that during any ATM transaction if someone comes and attacks, then the customer can enter the ATM pin in reverse order. This sends a message to the nearest police station. However if the reversed pin is the same as he original pin then no alarm is created. The bank needs a software application that checks that a user chooses an ATM pin whose reverse is not the same number. A software need to be developed with following requirements using while loop.

a. Read the pin number

b. Calculate the reverse the pin number

c. if the reversed pin is same as original pin then inform the user that this is an invalid pin number


In a box of total area 10000cm3, Mr. Varun has to pack the balls of given radius “r” and all the balls have the same volume, Help Mr. Varun to find the total number of balls that he can pack in the given box.

Requirements

Capture the radius of the ball “r”

Compute the volume (Hint: Volume=4/3πr3)

Calculate how many number of balls can be placed in the box of 10000cm3 box

Display the number of balls packed by Mr. Varun


LATEST TUTORIALS
APPROVED BY CLIENTS