Rust Basic Programs
- Rust program to print Hello World
- Rust program to create different types of variables
- Rust program to create different types of variables without specifying data types
- Rust program to demonstrate the escape sequences
- Rust program to create mutable variables
- Rust program to create constants
- Rust program to demonstrate the isize and usize datatypes
- Rust program to create a variable with binary value and print it in decimal number
- Rust program to create a variable with hexadecimal value and print it in the decimal number
- Rust program to create an alias of built-in data type
- Rust program to create string literals
- Rust program to print the length of string literal
- Rust program to read an integer number from the user
- Rust program to read a float number from the user
- Rust program to print the ASCII value of a character
- Rust program to demonstrate the arithmetic operators
- Rust program to demonstrate the assignment operators
- Rust program to demonstrate the relational operators
- Rust program to demonstrate the logical AND operator
- Rust program to demonstrate the logical OR (||) operator
- Rust program to demonstrate the logical NOT (!) operator
- Rust program to demonstrate the conditional operator
- Rust program to demonstrate the bitwise left-shift (<<) operator
- Rust program to demonstrate the bitwise right-shift (>>) operator
- Rust program to demonstrate the bitwise AND (&) operator
- Rust program to demonstrate the bitwise OR (|) operator
- Rust program to demonstrate the bitwise XOR (^) operator
- Rust program to swap two numbers using bitwise XOR (^) operator
- Rust program to set specific bit using bitwise operator
- Rust program to clear specific bit using bitwise operator
- Rust program to convert a decimal number to a binary number
- Rust program to get the minimum number of bits to store a number
- Rust program to check specific bit is HIGH (1) or LOW (0)
- Rust program to print the hexadecimal number of the given decimal number
- Rust program to print the binary number of a given decimal number
- Rust program to print the octal number of a given decimal number
- Rust program to swap two bytes of a number
- Rust program to reverse bits of a binary number
- Rust program to count the total number of HIGH (1) bits a given binary number
- Rust program to swap nibbles of a number
- Rust program to count the total number of trailing zeros
- Rust program to check a given number EVEN or ODD using bitwise operator
- Rust program to check a number contain the alternative pattern of bits
- Rust program to find the next number power of 2
- Rust program to find the position of MSB bit of an integer number
- Rust program to round off an integer number to the next lower power 2
- Rust program to find the total number of leading zeros in a binary number
- Rust program to read a number and print bits between given positions
- Rust program to swap two bits of a 32-bit integer number
- Rust program to check a given number is the power of 2 using bitwise operator
- Rust program to count the number of bits to be flipped to convert a number to another number
- Rust program to print the bit positions that need to be flipped to convert a number to another number
- Rust program to find the 1\'s complement of the given number
- Rust program to find the 2\'s complement of the given number
- Rust program to print the type of variables
- Rust program to calculate the area of the circle
- Rust program to calculate the perimeter of the circle
- Rust program to calculate the area of the rectangle
- Rust program to calculate the power of a given number
- Rust program to find the square root of the given number
- Rust program to demonstrate the use of abs() function
- Rust program to multiply two numbers using \'+\' operator
- Rust program to subtract a number without using the \'-\' operator
- Rust program to find the remainder without using the modulus (%) operator
- Rust program to calculate the HCF (Highest Common Factor)
- Rust program to check whether the given character is alphanumeric or not
- Rust program to check whether a character variable contains a digit or not
- Rust program to check whether a given character is a whitespace character or not
- Rust program to check whether a given character is a punctuation mark or not
- Rust program to check whether a given character is a printable character or not
- Rust program to convert a given number of days into days, weeks, and years
- Rust program to find the roots of a quadratic equation
- Rust program to find the GCD (Greatest Common Divisor)
- Rust program to find the LCM (Lowest Common Multiple)
- Rust program to calculate the area of a triangle given three sides
- Rust program to calculate the area of a triangle for a given base and height
- Rust program to calculate the area of Trapezium
- Rust program to calculate the area of Parallelogram
- Rust program to calculate the area of Cube
- Rust program to calculate the volume of Cube
- Rust program to find the Surface Area and Volume of the Cylinder
- Rust program to calculate the surface area, volume, and space diagonal of cuboids
- Rust program to calculate the surface area, the volume of the Cone
- Rust program to calculate the Surface Area and Volume of Sphere
- Rust program to read coordinate points and determine its quadrant
- Rust program to calculate the value of nCr
- Rust program to calculate the value of nPr
- Rust program to extract the last two digits from a given year
- Rust program to read the height of a person and the print person is taller, dwarf, or average height person
- Rust program to create own Power function without using multiplication (*) and division (/) operators
- Rust program to calculate the division without using division (/) operator
- Rust program to convert a float number into an integer number
- Rust program to convert an integer number into a float number
- Rust program to convert an integer into character
- Rust program to convert an unsigned integer into a signed integer
- Rust program to convert a string into an integer
- Rust program to convert a string into float
- Rust program to convert an integer into a string
- Rust program to calculate the power of float number using powi() function
- Rust program to calculate the power of float number using powf() function
- Rust program to calculate the cube root of a number
- Rust program to calculate the square root of a number using the powf() function
Program/Source Code:
The source code to read an integer number from the user is given below. The given program is compiled and executed successfully.
Output:
Explanation:
Here, we created a 32-bit floating-point variable num and then read the value for num from the user using the read_line() function and printed the result.
need an explanation for this answer? contact us directly to get an explanation for this answer