Advertisement
PROFESSOR_AIH

Dividing X by Y

Apr 4th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int x,y,n,i;
  5.     double res;
  6.     scanf("%d",&n);
  7.     for(i=1;i<=n;i++)
  8.     {
  9.         scanf("%d %d",&x,&y);
  10.         if(y!=0)
  11.         {
  12.             res=(double)x/y;
  13.             printf("%.1lf\n",res);
  14.         }
  15.         else
  16.             printf("divisao impossivel\n");
  17.         x=0;
  18.         y=0;
  19.     }
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement