Another solution ? How can I include a code block ?
- include <stdio.h>
main() {
// c current character // pc previous character int c, pc;
while ((c = getchar()) != EOF) { // A truthy evaluation implies 1 // (learned from chapter 1, exercice 6) // Avoid writing a space when // - the previous character is a space (+1) // AND // - the current character is a space (+1) // All the other combinations return an int < 2 if ((pc == ' ') + (pc == c) < 2) { putchar(c); } // update previous character pc = c; }
}
--Unsigned comment by Superina.
Welcome, Superina. You can include a code block by surrounding it with an opening <c> tag and a closing </c> tag. It's also good form to sign your comments to talk pages using the signature button one from the right at the top of the edit window. It shows up as --~~~~ when you're editing but when you save the page it gets replaced by something like this: --Laird (talk) 03:13, 28 January 2016 (UTC)
This is another bad approach from me (Ada123):
Points for being frank. But it doesn't do the task correctly. Have you tested it? Why is it here?--Nngnna (talk) 19:23, 9 June 2021 (AEST)