Hello beginner coder here is there anyway to print the week days without doing it like this
#include <stdio.h>
int main()
{
int nDay;
if (nDay == 1)
printf("Sunday");
else if (nDay == 2)
printf("Monday"); // and so on
return 0;
}
this way might be lengthy if I code till the 42th day, is there anyway to code this? i tried using modulos but it doesn't work like I wanted it to be.