Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,939 questions

51,876 answers

573 users

How to multiply two int numbers entered by user in Rust

1 Answer

0 votes
use std::io;

fn main() {
    println!("Input First number ? ");
    let mut in1 = String::new();
    io::stdin().read_line(&mut in1).expect("Unable to read your data");
 
    println!("Input second number ? ");
    let mut in2 = String::new();
    io::stdin().read_line(&mut in2).expect("Unable to read your data");
 
    let a: i32 = in1.trim().parse().ok().expect("Enter a number");
    let b: i32 = in2.trim().parse().ok().expect("Enter a number");

    println!("{}", a * b);
}



/*
run:
   
Input First number ? 9
Input second number ? 18
162
   
*/

 



answered Sep 29, 2022 by avibootz
...