Assignment
- Write a program in C where you would perform the following tasks:
- Declare a integer variable a whose value is 15, and another integer p whose value is 5.
- Make a call to function myPower() whose arguments are the integer value a and power value p. This function should return an integer value which you will assign to another integer value b which should be equal to a raised to p.
- You need to write your own function myPower()
- Ask your instructor how to write a function in C. iii. Do not use standard C function that calculates power. Instead write your own for loop that calculates power.
- Print a statement that looks similar to the following replacing a, p and b with their respective values.
a raised to the power p is b
- Write a C program to count the number of symbols that represent mathematical operations in a string. Mathematical operations include %, &, *, +, -, /, <, >, =, ^ and ~. You can define the string in your program as a character array. For demonstration purpose, your output should exactly look like following.
String: Do 42+53/76%8=2*8-32+71 & you can sleep. Contains: The string contains 8 symbols that represent mathematical operations.
Reviews
There are no reviews yet.