Q:
Swift program to print the character corresponding ASCII value
belongs to collection: Swift Basic Programs
Swift Basic Programs
- Swift program to print \'Hello World\'
- Swift program to create different types of variables
- Swift program to create variables with specifying data type
- Swift program to demonstrate the escape sequences
- Swift program to demonstrate the \'\\()\' to embed the value of the variable within the string
- Swift program to create a constant
- Swift program to create a constant with binary value and print it in decimal number
- Swift program to create a constant with hexadecimal value and print it in decimal number
- Swift program to create an alias of basic types
- Swift program to print the line number of source code using the #line directive
- Swift program to print the size of variables
- Swift program to read an integer number from the user
- Swift program to read a float number from the user
- Swift program to demonstrate the Int() function with Invalid value
- Swift program to print the character corresponding ASCII value
- Swift program to demonstrate the arithmetic operators
- Swift program to demonstrate the assignment operators
- Swift program to assign multiple variables in a single statement
- Swift program to demonstrate the unary minus \'-\' and unary plus \'+\' operators
- Swift program to demonstrate the comparison operators
- Swift program to demonstrate the logical AND (&&) operator
- Swift program to demonstrate the logical OR (||) operator
- Swift program to demonstrate the logical NOT (!) operator
- Swift program to demonstrate the closed range operator
- Swift program to demonstrate the Half-Open range operator
- Swift program to demonstrate the one-sided range operator
- Swift program to perform the bitwise left-shift operation
- Swift program to perform the bitwise right-shift operation
- Swift program to perform the bitwise AND operation
- Swift program to perform the bitwise OR operation
- Swift program to perform the bitwise XOR operation
- Swift program to perform the bitwise NOT operation
- Swift program to swap two numbers using the bitwise XOR operator
- Swift program to print the minimum and maximum value of data type Int8
- Swift program to print the minimum and maximum value of data type UInt8
- Swift program to print the minimum and maximum value of data type Int
Program/Source Code:
The source code to print the character corresponding ASCII value is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we imported a package Swift to use the print() function using the below statement,
Here, we created an integer variable ascVal initialized with 65. Then we converted the ASCII value into a corresponding character using UnicodeScalar() function and printed the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer