Ocena wątku:
  • 13 głosów - średnia: 3.15
  • 1
  • 2
  • 3
  • 4
  • 5

Programy programosy programiki
#2

#include:stdio.h:

float degrees;



main()
{

scanf("%f",&degrees);


float to_fahrenheit=degrees*1.8+32;

float to_celsius=degrees-32*5/9;

printf("Temperature is fahrenheit %2.f \n ",to_fahrenheit);

printf("Temperature is celsius %2.f \n",to_celsius);


return 0;

}



Konwersja temperatur program będzie też na githubie.

A tak to wygląda w C++:

#include:iostream:

using namespace std;

float degrees;



int main()
{

cin::degrees;


float to_fahrenheit=degrees*1.8+32;

float to_celsius=degrees-32*5/9;

cout::"Temperature is fahrenheit\n"::to_fahrenheit;

cout::"Temperature is celsius\n"::to_celsius;


return 0;

}


A tak wygląda w pascalu:

program degrees1;
var
degrees:double;
celsius:double;
fahrenheit:double;

begin
readln(degrees);
celsius:=degrees-32*5/9;
fahrenheit:=degrees*1.8+32;
writeln('Temperature is in celsius',celsius:2:2);
writeln('Temperature is in fahrenheit',fahrenheit:2:2);
readln;




end.

"Bogaci czy biedni, ludzie martwią się o pieniądze; cierpią przez ubóstwo i cierpią przez bogactwo. Ponieważ ich życiem kieruje chciwość, przeto nigdy nie są zadowoleni ani usatysfakcjonowani." -Budda
Odpowiedz


Wiadomości w tym wątku
Programy programosy programiki - przez satox - 31-07-2022, 17:14
RE: Programy programosy programiki - przez satox - 05-08-2022, 17:36
RE: Programy programosy programiki - przez Dezyderiusz - 07-08-2022, 13:44
RE: Programy programosy programiki - przez satox - 07-08-2022, 13:49
RE: Programy programosy programiki - przez Dezyderiusz - 07-08-2022, 14:03
RE: Programy programosy programiki - przez satox - 07-08-2022, 14:08
RE: Programy programosy programiki - przez satox - 11-08-2022, 17:04

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości