C Answers

Questions answered by 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

write a C program which will print following pattern on monitor

*

**

***

****

*****

******


Write a C program which will take numbers from the keyboard until user enter the negative number and display the max of these numbers

using

-while loop

-do while loop


Representatives




The principal of a school wants to speak with some of the students to as the overall development including studies. Mont 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.You are required to help Mr Sam in selecting K students that can speak with the principal from his class. You need to return an integer array representing the marks of the selected students sorted in ascending order.








Output Specification:




Return an integer array containing the marks of K selected students sorted in ascending order








Example 1:




input1: 10




input2: {950,477, 55, 602,881,302,859,438,551,382}




input3: 1



Output: {950}







Imagine that you are working in the production industry which produces leather shoe, for each pair of shoe your job is to label it using serial number given to you.

Assume that the serial number starts from 1 to 1000. But the serial number contains the repetition of the some number. Now your task is to identify the total number of repetition numbers in the serial list. Write a C program to provide the solution using array concept.

Test data:

The number of elements to be stored in the array is: 10


Enter the elements in tha array:


element 0: 1

element 1: 2

element 2: 3

element 3: 1

element 4: 4

element 5: 5

element 6: 6

element 7: 2

element 8: 5

element 9: 7


Expected output:

The count of repetition elements found in the array is: 3


Write a c program that must perform the following functionality in the main function declare a 3×5 array of a whole number, separetely prompt the user to enter 5 whole numbers using for row one using a FOR loop, separetely prompt the user to enter 5 whole numbers using WHILE loop, Multiply the elements in row one in with the elements in row two and updated to row three of array using a DO WHILE loop then use a IF statement to determine if the product is an even or odd number and then print out the number followed by whether is even or odd

Write a C program that performs arithmetic’s operation with fractions using four different functions (for addition, subtraction, multiplication and division). Use two integer variables to represent the numerator and the denominator as arguments to the functions. The functions should perform the following:


  • Addition of two rational numbers. The result should be stored in reduced form.   
  • Subtraction of two rational numbers. The result should be stored in reduced form.  
  • Multiplication of two Rational numbers. The result should be stored in reduced form.
  • Division of two Rational numbers. The result should be stored in reduced form.   


Printing Rational numbers in the form "a/b" where "a" is the numerator and "b" is the denominator.


In your function to print the Rational number, when the denominator is equal to zero, it must show the error message "DIVIDE BY ZERO ERROR!!!" Otherwise, print the Rational number in the required format. 


 Man's Best Friend

by CodeChum Admin

We all know what man's best friend is. A dog! 🐶


Let's create one in our program using the pre-existing struct Dog provided.



Instructions:

  1. In the code editor, you are provided with the definition of a struct Dog. This struct needs a string value for its breed. Furthermore, you are provided with a displayDog() function which accepts a struct Dog as its parameter.
  2. Your task is to create a Dog, take in a string user input, and then set it as the Dog's breed.
  3. Finally, call the displayDog() function and pass that Dog you created.

Write a program that works with fractions. Your program should be able to add, 

subtract, multiply, and divide two fractions. Write a separate function for addition, 

subtraction, multiplication and division. Specifically, your program must request 

two fractions from the user, getting the numerator and denominator separately for 

each fraction, and the operation to perform (add, subtract, multiply, or divide). 

Your program will then compute the resulting fraction, keeping the numerator and 

denominator separate, and output the result. 

Note:

Make the structure for fractions. Then declare variable of fractions and use 

them for addition and multiplication etc....


We've been dealing with integers too much, it's time for float to shine!





Instructions:



Input five float numbers.


Print out the float numbers in one line, separated by spaces, and make sure you only print up to 1 decimal place.


Add the first four float numbers and check if their sum is greater than the fifth float number. Print out "Yes" if they are.


Input



1. First float number



2. Second float number



3. Third float number



4. Fourth float number



5. Fifth float number



Output



The first five lines will contain message prompts to input the five float numbers.


The next line contains the inputted float numbers.


The last line contains "Yes" if the condition is true.



Enter·the·first·number:·1.1


Enter·the·second·number:·1.2


Enter·the·third·number:·1.3


Enter·the·fourth·number:·1.4


Enter·the·fifth·number:·1.1


1.1·1.2·1.3·1.4·1.1


Yes


Input


1. First number

2. Second number

3. Third number

Output

The first three lines will contain message prompts to input the three numbers.

The last line contains the product of the three numbers with 1 decimal place.

Enter·the·first·number:·1.6
Enter·the·second·number:·-2
Enter·the·third·number:·-1
Product·=·3.2






LATEST TUTORIALS
APPROVED BY CLIENTS