Tengo que hacer un sitio web html en el que tengo que poner todos los códigos C/C++/Java Pero cuando pongo el código C en html tag , la biblioteca C <stdio.h> en sí misma se trata como una etiqueta html debido a los corchetes angulares. ¿Qué debo hacer para tratar <stdio.h> como un texto simple y no como una etiqueta html?
<!DOCTYPE html> <html lang="en"> <meta charset="UTF-8"> <head> <title> codes </title> <script src="" ,type="text/javascript"> </script> </head> <body> <pre id="sumof2num"> <code> #include<stdio.h> int main() { int a; int b; //declaring vars int sum=0; //initializing vars printf("Enter Two Numbers: \n"); scanf("%d%d",&a,&b); sum=a+b; printf("Sum is %d",sum); return 0; } </code> </pre> </body> </html>si quiere decir que desea mostrar <> símbolos en el código, intente < y >. Mientras se renderiza como HTML, se convertirá en símbolos <>.
<html lang="en"> <meta charset="UTF-8"> <head> <title> codes </title> <script src="" ,type="text/javascript"> </script> </head> <body> <pre id="sumof2num"> <code> #include <stdio.h> int main() { int a; int b; //declaring vars int sum=0; //initializing vars printf("Enter Two Numbers: \n"); scanf("%d%d",&a,&b); sum=a+b; printf("Sum is %d",sum); return 0; } </code> </pre> </body> </html>