Starting from:

$30

CPE 325- Assignment #1  Solved


Assignment                                                                                
1.     Write a program in C where you would perform the following tasks:

a.     Declare a integer variable a whose value is 15, and another integer p whose value is 5.

b.     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.

i.     You need to write your own function myPower()

ii.   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.

c. 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 

2.     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. 


More products