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 186 views
1 answer 165 views
165 views asked May 18, 2025 by avibootz
1 answer 163 views
163 views asked Apr 27, 2025 by avibootz
1 answer 164 views
164 views asked Apr 27, 2025 by avibootz
1 answer 95 views
...