Write a C program using recursion to solve the Josephus problem (surviving position for n people and step k).
Two integers: n (people) and k (step count).
Print the 0-indexed or 1-indexed safe position.
1 <= n <= 50, 1 <= k <= 10
5 2
3
Recursive relation: J(n, k) = (J(n - 1, k) + k) % n with base case J(1, k) = 0.
#include <stdio.h>
int josephus(int n, int k) {
// Write your recursive logic here
}
int main() {
int n, k;
if (scanf("%d %d", &n, &k) == 2) {
printf("%dn", josephus(n, k) + 1); // 1-indexed output
}
return 0;
}Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used