diff --git a/src/to_be_organized/choco_wrapers_sum b/src/to_be_organized/choco_wrapers_sum new file mode 100644 index 0000000..d0544a5 --- /dev/null +++ b/src/to_be_organized/choco_wrapers_sum @@ -0,0 +1,24 @@ +use std::io; +//3 chocolates wrapers will give as chocolate +//this is used to find the total no of choclates retained +fn main() +{ + let mut rap:i32=0; + let mut m=String::new(); + io::stdin() + .read_line(&mut m) + .expect("failed to read from stdin"); + + let mut n = m.trim() + .parse::() + .unwrap(); + let mut tot:i32=n; + while n>2 + { + tot=tot+n/3; + rap=n-n/3*3+n/3; + n=rap; + } + println!("no of chocolates={}",tot); + print!("no of wrapers={}",rap); +}