Skip to content

Instantly share code, notes, and snippets.

@ivanelson
Created December 14, 2018 14:42
Show Gist options
  • Select an option

  • Save ivanelson/3cbbdd07274545466d1ac597458fb679 to your computer and use it in GitHub Desktop.

Select an option

Save ivanelson/3cbbdd07274545466d1ac597458fb679 to your computer and use it in GitHub Desktop.
Convert Celsius to Fahrenheit in "C"
#include <stdio.h>
#include <stdlib.h>
/*
F=1,8C + 32
*/
void main() {
float soma=0;
int valorInicial, valorFinal, contador;
printf("Digite o valor da temperatura inicial: \n");
scanf("%d", &valorInicial);
printf("Digite o valor da temperatura final: \n");
scanf("%d", &valorFinal);
for (contador = valorInicial; contador <= valorFinal; contador++) {
printf("\n%d Celsius = %.1f Fahrenheit", contador, 1.8 * contador + 32);
} // Esta chave encerra o laco "for"
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment