Click a topic to learn more.
C Input main() { float fahr; printf("Enter Fahrenheit: "); scanf("%f", &fahr); printf("Celsius is %f\n", (fahr-32)*5/9); } Rust Translation #![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_assignments, unused_mut)] #![register_tool(c2rust)] #![feature(register_tool)] extern "C" { fn printf(_: *const libc::c_char, _: ...) -> libc::c_int; fn scanf(_: *const libc::c_char, _: ...) -> libc::c_int; } unsafe fn main_0() -> libc::c_int { let mut fahr: libc::c_float = 0.; printf(b"Enter Fahrenheit: \0" as *const u8 as *const libc::c_char); scanf(b"%f\0" as *const u8 as *const libc::c_char, &mut fahr as *mut libc::c_float); printf( b"Celsius is %f\n\0" as *const u8 as *const libc::c_char, ((fahr - 32 as libc::c_int as libc::c_float) * 5 as libc::c_int as libc::c_float / 9 as libc::c_int as libc::c_float) as libc::c_double, ); return 0; } pub fn main() { unsafe { ::std::process::exit(main_0() as i32) } }