Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. void main()
  4. {
  5.     float a,b,m;
  6.     char z;
  7.  
  8.     printf("Please enter:\nL to solve a linear equation\nD to calculate the number of days in month\nW to calculate the number of weeks and days\n");
  9.     fflush(stdin);
  10.     scanf("%c",&z);
  11.     if (z=='L')
  12.         printf("Please enter the equation ax+b=0 arguments: a and b\n");
  13.         fflush(stdin);
  14.         scanf("%f%f", &a,&b);
  15.         {
  16.             if(a==0 && b==0)
  17.                 printf("There are infinity solutions\n");
  18.             if(a!=0 && b!=0)
  19.             {
  20.                 m=-b/a;
  21.                 printf("There is a single solution: %f\n", m);
  22.             }
  23.             if(a==0 && b!=0)
  24.                 printf("There is no solution for the equation\n");
  25.        
  26.        
  27.        
  28.         }
  29.  
  30.        
  31.     getchar();
  32.     getchar();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement