(1) Exercise1 Write a program that gets an input line from the user (ends with ‘
ID: 3621207 • Letter: #
Question
(1) Exercise1Write a program that gets an input line from the user (ends with ‘ ’) and displays the number of times
each letter appears in it.
Example:
For the input line: hello, world!
The output should be:
d = 1
e = 1
h = 1
l = 3
o = 2
w = 1
r = 1
Assume that the input is all in lower-case.
(2) Exercise2
Implement a function that accepts two integer arrays and returns 1 if they are equal, 0 otherwise.
Write a program that accepts two arrays of integers from the user and checks for equality using the
function.
(3) Exercise3
• Write a program that defines 3 matrices A, B, C of size 3x3 with float elements; initialize the first two
matrices (A and B)
• Compute the matrix multiplication of A and B and store it in C (i.e. C = A*B)
• Matrix Multiplication:
Print all the matrices on the screen
(4) Exercise4
Write a function that accepts a double parameter and returns its integer and fraction parts.
Write a program that accepts a number from the user and prints out its integer and fraction parts, using
this function.
(5) Exercise5
• Write a program that accepts two numbers as command line arguments, representing a rectangle’s
height and width (as floating-point numbers).
• The program should display the rectangle’s area and perimeter.
Explanation / Answer
Rectangle’s area and perimeter: #include int main() { float h,w,rect_area,rect_per; printf("Enter length of rectangle : "); scanf("%f",&h); printf("Enter width of rectangle: "); scanf("%f",&w); rect_area = (h * w); rect_per = ((2*w)+ (2*h)); printf(" The rectangle area is %f",rect_area); printf(" The rectangle perimeter is %f",rect_per); system("pause"); } I hope this will helps to You !Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.