Program1:
Expand|Select|Wrap|Line Numbers
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- int num1,num2;
- printf("Enter a number: ");
- scanf("%d", &num1);
- for(num2 = 0; num2 < 9; num2++)
- {
- printf("power %d: %d\n", num2, ((int)(num1/pow(2, num2))));
- }
- return;
- }
Program 2:
Expand|Select|Wrap|Line Numbers
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- int num1,num2,num3;
- printf("Enter a number: ");
- scanf("%d", &num1);
- for(num2 = 0; num2 < 9; num2++)
- {
- num3= num1>>num2;
- printf("power %d: %d\n", num2, num3);
- }
- return;
- }
Answer managing to get the first two sets of programs to run correctly:
1. How is the math library available within the file system?
2. What are the names of the files that correspond to the math library?
3. List at least two possible ways for linking against the math library.
4. Is there an alternative way for generating the “string-compare-2”executable file? If yes, describe it.
THANKS AGAIN!!