How to convert int to char with the same value in Go

1 Answer

0 votes
package main

import "fmt"

func main() {
	intValue := 7 

	// Convert the int to a rune (char)
	charValue := rune(intValue + 48)

	fmt.Printf("Character value: %c\n", charValue)
}


/*
run:

Character value: 7

*/

 



answered Apr 27, 2025 by avibootz

Related questions

1 answer 298 views
1 answer 274 views
274 views asked May 18, 2025 by avibootz
1 answer 258 views
258 views asked Apr 27, 2025 by avibootz
1 answer 266 views
266 views asked Apr 27, 2025 by avibootz
1 answer 195 views
...