Rust program to calculate the area and circumference of a circle
kw.rs
fnmain(){constPI:f32=3.14;letr=5;letr=rasf32;println!("———————————————————————————————————————————");println!("Program to calculate the area and circumference of a circle");println!("———————————————————————————————————————————");println!("The area of a circle is {c}",c=PI*r*r);println!("The circumference of a circle is {c}",c=2.0*PI*r);println!("———————————————————————————————————————————");}
Output
kodingwindow@kw:~$ rustc kw.rs kodingwindow@kw:~$ ./kw
———————————————————————————————————————————
Program to calculate the area and circumference of a circle
———————————————————————————————————————————
The area of a circle is 78.5
The circumference of a circle is 31.400002
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.