[Tutorial] CoLoR format the Code!

Really quick tutorial for all forum members who dont know how to color format code like this which i learned from another site.

just use 3 backticks ``` before and after the code and your code looks like this :point_down::point_down::point_down:

CPP :

    #include <iostream>
    using namespace std;

    int main() {
    	for(int i=0 ; i < 10 ;++i) {
    		cout << i <<" - hello world\n";
    	}
    	return 0;
    }

Python :

# Python 3 program to find 
# factorial of given number 
def factorial(n): 
	return 1 if (n==1 or n==0) else n * factorial(n - 1); 

num = 5; 
print("Factorial of",num,"is", 
factorial(num)) 
41 Likes

Can this post please be pinned, or included in the information people get when they create a blog (currently it’s just something about cheating, but that’s not going to affect anything anyway, and could be filled with much more useful stuff)? Look at how many times this post has been linked now.

11 Likes
cout<<"Got it "<<endl;

+1

1 Like
 cout<<"works"<<endl;

cout<<"This is cool"<<"\n";

didn’t work :frowning:

#include <iostream>
using namespace std;

int main() {
    int a=5, b=0;

    //divide by zero. ;_;
    a=a/b;

    cout<<a<<"\n";

    return 0;
}
print("we")
asdasdasdasssssssss
sa
das
d
asda
sd

it works

printf("Hello World");
print("Hello World");
cout>>"Hello world">>endl;
println("Hello World");

i was lost in finding backtick key lol

1 Like

Just copy and paste from the original post :stuck_out_tongue:

2 Likes