Hi. I'm new here and also a newbie programmer.
I'm taking a course in C and I'm having trouble with my assignment
I'm suppose to create a menu to do a couple of things, one of them is to make the menu print again every time the user inputs '1' into the variable I've assigned. problem is it does reprint but only once, when I input '1' again it quit the program.
Code:
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>
void main(){
int choice;
printf("The menu:\n");
printf("0. Exit.\n");
printf("1. Print menu again.\n");
printf("2. Number details in range.\n");
printf("3. Layers square printing.\n");
printf("Please enter your choice :\n");
scanf("%d", &choice);
if (choice == 0){
printf("bye bye!\n");
}
while (choice == 1){
printf("The menu:\n");
printf("0. Exit.\n");
printf("1. Print menu again.\n");
printf("2. Number details in range.\n");
printf("3. Layers square printing.\n");
printf("Please enter your choice :\n");
scanf("%d", &choice);
}
BTW, I'm not allowed to use switch or almost anything so I have to make it minimal..
Also, the 2nd option is supposed to take a number and print all the number up to it and wether it's a prime number, a palindrome number and a few more.. I know how to check wether a number is prime or not but I'm having trouble printing a list and have it check each number and also print it's description.. Thanks in advance