Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 001
- Write a function void print_perimeter_trapez(unsigned int a, unsigned int b, unsigned int c, unsigned int d), which prints "Perimeter of trapez(a,b,c,d) = P". For computing and printing use functions perimeter_trapez(unsigned int a, unsigned int b, unsigned int c, unsigned int d,) and printf.
- 002
- Write a function void print_sum(int n), which prints "sum(n) = S". Where S is the sum of the numbers to n including n. For computing and printing use functions int sum(int n) and printf.
- 003
- Write a function void print_fib(unsigned short n), which prints "fib(n) = F" Where F is the Fibonacci number at position n . For computing and printing use functions int fib(unsigned short n) and printf.
- 004
- Write a function void print_letter_of_my_strdup(char* s, unsigned short n), which prints "my_strdup[n] = L" where L is the letter or ASCII number of the letter at position n. For making a duplicate of the string use a function char *my_strdup(char *s) and for printing use function printf.
- Tip: Create a string to be duplicated in main() using char *s = (char *)malloc(5 * sizeof(char)); s[0] = 'a'; s[1] = 'b'; s[2] = 'c'; s[3] = 'd'; s[4] = 'e'; s[5] = 0;
- 005
- Write a function void print_perimeter_of_rectangle(int a, int b), which prints "Perimeter of rectangle(a, b) = P". For computing and printing use functions int perimeter_of_rectangle(int a, int b) and printf.
- 006
- Write a function void print_area_of_rectangle(int a, int b), which prints "Area of rectangle(a, b) = S". For computing and printing use functions int area_of_rectangle(int a, int b) and printf.
- 007
- Write a function void print_perimeter_of_triangle(int a, int b, int c), which prints "Perimeter of triangle(a, b, c) = P". For computing and printing use functions int perimeter_of_triangle(int a, int b, int c) and printf.
- 008
- Write a function void print_perimeter_of_rectangular_triangle(int a, int b), which prints "Perimeter of rectangular triangle(a, b) = P". For computing and printing use functions int perimeter_of_rectangular_triangle(int a, int b) and printf.
- 009
- Write a function void print_area_of_triangle(int a, int b, int c), which prints "Area of triangle(a, b, c) = S". For computing and printing use functions int area_of_triangle(int a, int b, int c) and printf.
- 010
- Write a function void print_area_of_cube(int a), which prints "Area of cube(a) = S". For computing and printing use functions int area_of_cube(int a) and printf.
- 011
- Write a function void print_avg_int(int a, int b, int c), which prints "Average of (a, b, c) = A". The average is an integer number. For computing and printing use functions int avg_int(int a, int b, int c) and printf.
- 012
- Write a function void print_avg_short(short a, short b, short c), which prints "Average of (a, b, c) = A". The average is an integer number. For computing and printing use functions short avg_short(short a, short b, short c) and printf. The function short avg_short(short a, short b, short c) calculates the average value of these three short numbers.Try that it works correctly for both positive and negative numbers(including their mix).
- 013
- Write a function void print_max(unsigned char a, short b, int c), which prints "Max of (a, b, c) = M". M is the biggest of these 3 numbers. For computing and printing use functions int max(unsigned char a, short b, int c) and printf.
- 014
- Write a function void print_min(unsigned char a, short b, int c), which prints "Min of (a, b, c) = M". M is the smallest of these 3 numbers. For computing and printing use functions int min(unsigned char a, short b, int c) and printf.
- 015
- Write a function void print_positive(int a, int b, int c), which prints "Positive of (a, b, c) = P". Where P is 1 if all arguments are positive, otherwise 0. For computing and printing use functions int positive(int a, int b, int c) and printf.
- 016
- Write a function void print_power(int n, unsigned int m), which prints "Pow (n,m) = P". Where P is n to the power of m (n^m). For computing and printing use functions int power(int n, unsigned int m) and printf.
- 017
- Write a function void print_powers_element(unsigned short n), which prints "Pow (n) = P". Where P is the n-th element of an array[10], created by function void powers(). Create a static field of 10 short elements.Write the function void powers(), which will store numbers 1 to power of 2, 2 to power of 2, ..., 10 to power of 2 in the field. For printing use printf.
- 018
- Write a function void print_powers_element(unsigned short n), which prints "Pow (n) = P". Where P is the n-th element of an array[10], created by function void powers(). Create a field(using a malloc call from C) of 10 int types.Write the function void powers(), which will store numbers 2 to the power of 0, 2 to the power of 1, ..., 2 to the power of 9 in the field.. For printing use printf.
- 019
- Write a function void print_array_min_element(), which prints "Min =M". Where M is the smallest element of an array[10]. Write int minimum() function that returns the smallest array element. In the body of this function in C, create a local variable of the field type of the size of 10 int elements from which the values will be selected. (int local[10] = {10, 15, 1, 28, 16, -18, 5, 20, 1, 3};). Try that the function works correctly for both positive and negative numbers. For printing use printf.
- 020
- Write a function void print_array_max_element(), which prints "Max =M". Where M is the biggest element of an array[10]. Write int max() function that returns the biggest array element. In the body of this function in C, create a local variable of the field type of the size of 10 int elements from which the values will be selected. (int local[10] = {10, 15, 1, 28, 16, -18, 5, 20, 1, 3};). Try that the function works correctly for both positive and negative numbers. For printing use printf.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement