Guest User

Untitled

a guest
Apr 25th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. /*
  2.  * temp.c
  3.  *
  4.  * Copyright 2011 Aivaras Kivilius <aivaras@Area51>
  5.  */
  6.  
  7.  
  8. #include <stdio.h>
  9.  
  10. int main(int argc, char **argv)
  11. {
  12.     int tempC;
  13.     int tempF;
  14.     int var;
  15.     int temp;
  16.     printf("You have F(type 0) or C (type 1)?\n");
  17.     scanf ("%d",&var);
  18.     printf("Temperature:\n");
  19.     scanf ("%d", &temp);
  20.     if (var == 0)
  21.         {
  22.             tempC=(temp - 32) * 5 / 9;
  23.             printf("its %d \n", tempC);
  24.         }
  25.     else
  26.         {
  27.             tempF=temp * 9 / 5 - 32;
  28.             printf("its %d \n", tempF);
  29.         }
  30.     printf("\n");
  31.     return 0;
  32. }
Add Comment
Please, Sign In to add comment