Rust Basic Programs

This section contains the basic programs of Rust Programming Language like printing text, reading values, programs based on the basic operators, etc.

Practice these Rust Basic Programs to learn the basic concepts of Rust, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Rust Basic Programs.

List of Rust Basic Programs

  1. Rust program to print Hello World
  2. Rust program to create different types of variables
  3. Rust program to create different types of variables without specifying data types
  4. Rust program to demonstrate the escape sequences
  5. Rust program to create mutable variables
  6. Rust program to create constants
  7. Rust program to demonstrate the isize and usize datatypes
  8. Rust program to create a variable with binary value and print it in decimal number
  9. Rust program to create a variable with hexadecimal value and print it in the decimal number
  10. Rust program to create an alias of built-in data type
  11. Rust program to create string literals
  12. Rust program to print the length of string literal
  13. Rust program to read an integer number from the user
  14. Rust program to read a float number from the user
  15. Rust program to print the ASCII value of a character
  16. Rust program to demonstrate the arithmetic operators
  17. Rust program to demonstrate the assignment operators
  18. Rust program to demonstrate the relational operators
  19. Rust program to demonstrate the logical AND operator
  20. Rust program to demonstrate the logical OR (||) operator
  21. Rust program to demonstrate the logical NOT (!) operator
  22. Rust program to demonstrate the conditional operator
  23. Rust program to demonstrate the bitwise left-shift (<<) operator
  24. Rust program to demonstrate the bitwise right-shift (>>) operator
  25. Rust program to demonstrate the bitwise AND (&) operator
  26. Rust program to demonstrate the bitwise OR (|) operator
  27. Rust program to demonstrate the bitwise XOR (^) operator
  28. Rust program to swap two numbers using bitwise XOR (^) operator
  29. Rust program to set specific bit using bitwise operator
  30. Rust program to clear specific bit using bitwise operator
  31. Rust program to convert a decimal number to a binary number
  32. Rust program to get the minimum number of bits to store a number
  33. Rust program to check specific bit is HIGH (1) or LOW (0)
  34. Rust program to print the hexadecimal number of the given decimal number
  35. Rust program to print the binary number of a given decimal number
  36. Rust program to print the octal number of a given decimal number
  37. Rust program to swap two bytes of a number
  38. Rust program to reverse bits of a binary number
  39. Rust program to count the total number of HIGH (1) bits a given binary number
  40. Rust program to swap nibbles of a number
  41. Rust program to count the total number of trailing zeros
  42. Rust program to check a given number EVEN or ODD using bitwise operator
  43. Rust program to check a number contain the alternative pattern of bits
  44. Rust program to find the next number power of 2
  45. Rust program to find the position of MSB bit of an integer number
  46. Rust program to round off an integer number to the next lower power 2
  47. Rust program to find the total number of leading zeros in a binary number
  48. Rust program to read a number and print bits between given positions
  49. Rust program to swap two bits of a 32-bit integer number
  50. Rust program to check a given number is the power of 2 using bitwise operator
  51. Rust program to count the number of bits to be flipped to convert a number to another number
  52. Rust program to print the bit positions that need to be flipped to convert a number to another number
  53. Rust program to find the 1's complement of the given number
  54. Rust program to find the 2's complement of the given number
  55. Rust program to print the type of variables
  56. Rust program to calculate the area of the circle
  57. Rust program to calculate the perimeter of the circle
  58. Rust program to calculate the area of the rectangle
  59. Rust program to calculate the power of a given number
  60. Rust program to find the square root of the given number
  61. Rust program to demonstrate the use of abs() function
  62. Rust program to multiply two numbers using '+' operator
  63. Rust program to subtract a number without using the '-' operator
  64. Rust program to find the remainder without using the modulus (%) operator
  65. Rust program to calculate the HCF (Highest Common Factor)
  66. Rust program to check whether the given character is alphanumeric or not
  67. Rust program to check whether a character variable contains a digit or not
  68. Rust program to check whether a given character is a whitespace character or not
  69. Rust program to check whether a given character is a punctuation mark or not
  70. Rust program to check whether a given character is a printable character or not
  71. Rust program to convert a given number of days into days, weeks, and years
  72. Rust program to find the roots of a quadratic equation
  73. Rust program to find the GCD (Greatest Common Divisor)
  74. Rust program to find the LCM (Lowest Common Multiple)
  75. Rust program to calculate the area of a triangle given three sides
  76. Rust program to calculate the area of a triangle for a given base and height
  77. Rust program to calculate the area of Trapezium
  78. Rust program to calculate the area of the rhombus
  79. Rust program to calculate the area of Parallelogram
  80. Rust program to calculate the area of Cube
  81. Rust program to calculate the volume of Cube
  82. Rust program to find the Surface Area and Volume of the Cylinder
  83. Rust program to calculate the surface area, volume, and space diagonal of cuboids
  84. Rust program to calculate the surface area, the volume of the Cone
  85. Rust program to calculate the Surface Area and Volume of Sphere
  86. Rust program to read coordinate points and determine its quadrant
  87. Rust program to calculate the value of nCr
  88. Rust program to calculate the value of nPr
  89. Rust program to extract the last two digits from a given year
  90. Rust program to read the height of a person and the print person is taller, dwarf, or average height person
  91. Rust program to create own Power function without using multiplication (*) and division (/) operators
  92. Rust program to calculate the division without using division (/) operator
  93. Rust program to convert a float number into an integer number
  94. Rust program to convert an integer number into a float number
  95. Rust program to convert an integer into character
  96. Rust program to convert an unsigned integer into a signed integer
  97. Rust program to convert a string into an integer
  98. Rust program to convert a string into float
  99. Rust program to convert an integer into a string
  100. Rust program to calculate the power of float number using powi() function
  101. Rust program to calculate the power of float number using powf() function
  102. Rust program to calculate the cube root of a number
  103. Rust program to calculate the square root of a number using the powf() function



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.