Conversor de Temperaturas
Publicado por White Hawk (última atualização em 07/07/2011)
[ Hits: 25.178 ]
Download conversor_temperatura.c
Este é um script em C que realiza a conversão de temperaturas entre as escalas Celsius, Fahrenheits e Kelvin.
#include <stdio.h> int opcao; float tc, tf, tk; void Celsius_Fahrenheits() { printf("\nDigite a temperatura em Celsius.: "); scanf("%f", &tc); tf = ((9*tc + 160)/5); printf("\nA temperatura em Fahrenheits = %f\n", tf); } void Celsius_Kelvin() { printf("\nDigite a temperatura em Celsius.: "); scanf("%f", &tc); tk = (tc + 273); printf("\nA temperatura em Kelvin = %f\n", tk); } void Fahrenheits_Celsius() { printf("\nDigite a temperatura em Fahrenheits.: "); scanf("%f", &tf); tc = ((5*(tf - 32))/9); printf("\nA temperatura em Celsius = %f\n", tc); } void Fahrenheits_Kelvin() { printf("\nDigite a temperatura em Fahrenheits.: "); scanf("%f", &tf); tk = ((5*tf + 2297)/9); printf("\nA temperatura em Kelvin = %f\n", tk); } void Kelvin_Celsius() { printf("\nDigite a temperatura em Kelvin.: "); scanf("%f", &tk); tc = (tk - 273); printf("\nA temperatura em Celsius = %f\n", tc); } void Kelvin_Fahrenheits() { printf("\nDigite a temperatura em Kelvin.: "); scanf("%f", &tk); tf = ((9*tk - 2297)/5); printf("\nA temperatura em Fahrenheits = %f\n", tf); } main() { printf("==========CELSIUS <-> FAHRENHEITS==========\n"); printf("\n1-Celsius -> Fahrenheits\n2-Celsius -> Kelvin\n3-Fahrenheits -> Celsius\n4-Fahrenheits -> Kelvin\n5-Kelvin -> Celsius\n6-Kelvin -> Fahrenheits\n7-Sair\n\nOpcao.: "); scanf("%d", &opcao); switch (opcao) { case 1: Celsius_Fahrenheits(); break; case 2: Celsius_Kelvin(); break; case 3: Fahrenheits_Celsius(); break; case 4: Fahrenheits_Kelvin(); break; case 5: Kelvin_Celsius(); break; case 6: Kelvin_Fahrenheits(); break; case 7: printf("\nFinalizando o programa...\n"); break; default: printf("\nErro! Opcao inexistente.\n"); break; } return(0); }
3025 -> 30 + 25 = 55 -> 55*55 = 3025
Uma ajuda para quem gosta de Geometria Analítica
Instalar e Configurar o Slackware Linux em 2025
Como configurar os repositórios do apt no Debian 12 em 2025
Passkeys: A Evolução da Autenticação Digital
Instalação de distro Linux em computadores, netbooks, etc, em rede com o Clonezilla
Configurando o Conky para iniciar corretamente no sistema
3 configurações básicas que podem melhorar muito a sua edição pelo editor nano
Como colorir os logs do terminal com ccze
Instalação Microsoft Edge no Linux Mint 22
Como configurar posicionamento e movimento de janelas no Lubuntu (Openbox) com atalhos de teclado
Novo problema! Erro durante a atualização! (7)
Linux Mint não conecta Wi-Fi sem fio (1)
Tenho um problama de quebra de pacote e não descobri como resolver [RE... (2)
driver do repositorio debian nao atende o requisito minimo (7)