Settings
How C code is coloured and set, everywhere on the site. Changes apply as you make them and are kept on this device.
How it looks
- 1#include <stdio.h>
- 2#define MAX 6
- 3
- 4// Add up the digits of n.
- 5int sumDigits(int n) {
- 6 int sum = 0;
- 7 while (n > 0) {
- 8 sum += n % 10; (just ran)
- 9 n /= 10; (runs next)
- 10 }
- 11 return sum;
- 12}
- 13
- 14int main(void) {
- 15 int n;
- 16 char *label = "Sum: ";
- 17 scanf("%d", &n);
- 18 if (n < 0 || n > MAX * 1000) return 1;
- 19 printf("%s%d\n", label, sumDigits(n));
- 20 return 0;
- 21}
Code colours
The roles an editor uses, with no green or red: those two still mean right and wrong here.
Keywords
#7fb4ffTypes
#62d0e0Functions
#e6d88aNames
#dcdcdcNumbers and constants
#cfa8ffStrings
#e3a577Escapes and placeholders
#ffd0a8Preprocessor
#e08fc4Comments
#959bb6Operators and brackets
#b4b9d0
Code font
Ligatures are off in every face: != stays two characters, the way you type it.