Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main() {
- float a = 0;
- float b = 0;
- float h = 0;
- printf("Enter a = ");
- if(scanf("%f", &a) != 1)
- {
- printf("Error.\n");
- return 0;
- }
- printf("Enter b = ");
- if(scanf("%f", &b) != 1)
- {
- printf("Error.\n");
- return 0;
- }
- printf("Enter h = ");
- if(scanf("%f", &h) != 1)
- {
- printf("Error.\n");
- return 0;
- }
- if(a > b || h <= 0)
- {
- printf("Input Error.");
- return 0;
- }
- printf("x\ty(x)\n");
- printf("%f\n", cos(a));
- float o = a+h;
- while(o <= b)
- {
- printf("%f\t%f\n", o, cos(o));
- o = o + h;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement