PLEASE HELP ME ON THE NESTED LOOPING FUNCTION ON THE LAST... WHERE IN (When done, ask user to repeat or go back to main menu) So it must return to Main function when the user will choose "N" pleaseee,,, #include #include int ch; void Nestedlooping(); void Recursion(); void Array(); void FileHandling(); void Exit(); void main() { while (1); printf("\n\n\t\t\t oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\n"); printf("\n\n\t\t\t oo \t\t ALLEAH CPE112 Final Exam Menu Programs oo"); printf("\n\n\t\t\t oo \t\t \n\nPress (1) for Nested Looping oo"); printf("\n\n\t\t\t oo \t\t \nPress (2) for Recursion oo"); printf("\n\n\t\t\t oo \t\t \nPress (3) for Array oo"); printf("\n\n\t\t\t oo \t\t \nPress (4) for File Handling oo"); printf("\n\n\t\t\t oo \t\t \nPress (5) to Exit oo\n"); printf("\n\n\t\t\t oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\n"); printf("\n\n\n-----------------------------------------------------------------------------------------------------------------------\n"); printf("\n\n\n\n\n\t\t\t\t Please input your chosen program: \n\n\t\t\t\t\t\t\t"); scanf("%d", &ch); switch (ch) { case 1: Nestedlooping(); break; case 2: Recursion(); break; case 3: Array(); break; case 4: FileHandling(); break; case 5: Exit(); break; default: printf("\n\t\t\tInvalid Option, Please Enter Right Option !\n"); } } //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------// // N E S T E D L O O P I N G //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------// void Nestedlooping(); { int n, i; char in; do { printf("Enter an integer: \n"); scanf("%d", &n); if(n>=1 && n<=10) { for (i = 1; i <= 10; ++i) { printf("%d * %d = %d \n", n, i, n * i); } } else { printf("Number not in the range\n"); } printf("\nPress y to continue and n to go back to menu?(y/n): \n"); scanf(" %c", &in); getch(); main(); } while(in=='y'); }
PLEASE HELP ME ON THE NESTED LOOPING FUNCTION ON THE LAST... WHERE IN (When done, ask user to repeat or go back to main menu)
So it must return to Main function when the user will choose "N" pleaseee,,,
#include <stdio.h>
#include <conio.h>
int ch;
void Nestedlooping();
void Recursion();
void Array();
void FileHandling();
void Exit();
void main()
{
while (1);
printf("\n\n\t\t\t oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\n");
printf("\n\n\t\t\t oo \t\t ALLEAH CPE112 Final Exam Menu Programs oo");
printf("\n\n\t\t\t oo \t\t \n\nPress (1) for Nested Looping oo");
printf("\n\n\t\t\t oo \t\t \nPress (2) for Recursion oo");
printf("\n\n\t\t\t oo \t\t \nPress (3) for Array oo");
printf("\n\n\t\t\t oo \t\t \nPress (4) for File Handling oo");
printf("\n\n\t\t\t oo \t\t \nPress (5) to Exit oo\n");
printf("\n\n\t\t\t oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\n");
printf("\n\n\n-----------------------------------------------------------------------------------------------------------------------\n");
printf("\n\n\n\n\n\t\t\t\t Please input your chosen program: \n\n\t\t\t\t\t\t\t");
scanf("%d", &ch);
switch (ch)
{
case 1:
Nestedlooping();
break;
case 2:
Recursion();
break;
case 3:
Array();
break;
case 4:
FileHandling();
break;
case 5:
Exit();
break;
default:
printf("\n\t\t\tInvalid Option, Please Enter Right Option !\n");
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
// N E S T E D L O O P I N G
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
void Nestedlooping();
{
int n, i;
char in;
do
{
printf("Enter an integer: \n");
scanf("%d", &n);
if(n>=1 && n<=10)
{
for (i = 1; i <= 10; ++i)
{
printf("%d * %d = %d \n", n, i, n * i);
}
}
else
{
printf("Number not in the range\n");
}
printf("\nPress y to continue and n to go back to menu?(y/n): \n");
scanf(" %c", &in);
getch();
main();
}
while(in=='y');
}
Step by step
Solved in 3 steps with 4 images