Exam 01 Piscine 42 Exclusive May 2026
Your grade = The level of the last exercise you solved perfectly.
The Renderium tests edge cases viciously. For any function taking a pointer (e.g., char *str), the first three lines of your code should check if (str == NULL) return (NULL or 0). If you forget this, you fail the exclusive edge-case tests.
Task: Take a positive integer as an argument and display the sum of all prime numbers less than or equal to it.
In the 42 exam environment, you cannot copy-paste from the internet, but you can copy-paste within your own terminal. Write a standard template: exam 01 piscine 42 exclusive
#include <unistd.h>// Function here
int main(void) // Hidden from Moulinette, but useful for your own testing ft_putstr("Hello Exam 01"); return (0);
Exclusive trick: Comment out your main before grademe. Moulinette expects only the function. If you leave main in, you get a compilation error (score -42).
Task: Print numbers from 9 down to 0.
unsigned char ft_exclusive(unsigned char a, unsigned char b) unsigned char result = 0; int i = 0;while (i < 8) unsigned char bit_a = (a >> i) & 1; unsigned char bit_b = (b >> i) & 1; unsigned char xor_bit = (bit_a ^ bit_b); // still uses ^, replace with: // xor_bit = (bit_a return (result);
To completely avoid ^, replace the line:
unsigned char xor_bit = (bit_a | bit_b) & ~(bit_a & bit_b);
❌ Using printf → Instant 0 (forbidden functions)
❌ Using write without <unistd.h> → Compilation error
❌ Forgetting int main(void) → Exam uses main to test your function
❌ Infinite loops in ft_print_comb → Forgot to reset second variable
❌ Not testing with gcc -Wall -Wextra -Werror before examshell
❌ Submitting .c file with same name as exercise? No – exam expects ft_putchar.c exactly. Your grade = The level of the last