Conversor de Temperaturas
Publicado por White Hawk (última atualização em 07/07/2011)
[ Hits: 25.634 ]
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);
}
Calculo de Área e Diametro do circulo
Crivo de Eratóstenes Simples em C
Função simples sendo chamada dentro da main
Converte Celsius para Farenheit
XFCE - quase um Gnome ou Plasma mas muito mais leve
LXQT - funcional para máquinas pererecas e usuários menos exigentes
Instalação do K3s Single-Node com Rancher no Ubuntu 24.04
Usei o NotebookLM para Auditar Logs do Linux
Cinnamon seria a aposta acertada frente às outras interfaces gráficas mais populares?
[Resolvido] Sumiço de redes e micro quedas no iwd/iwgtk (Realtek rtw88)
Como Configurar DNS Reverso (PTR) em Ambientes Linux e Microsoft
Preparando o Ambiente para Administrar o Samba 4 a partir do Windows com RSAT
WiFi Seguro: EAP-TLS com FreeRADIUS e Active Directory (LDAP)
A diferença entre a fala de um Samuel e a fala de alguém que conhece o... (4)









