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