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 297 views
1 answer 273 views
273 views asked May 18, 2025 by avibootz
1 answer 257 views
257 views asked Apr 27, 2025 by avibootz
1 answer 264 views
264 views asked Apr 27, 2025 by avibootz
1 answer 195 views
...