C# Corner
Tech
News
Videos
Forums
Trainings
Books
Live
More
Interviews
Events
Jobs
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Simple C Program of While Loop and Switch Case
WhatsApp
Krishna Rajput Singh
Jun 28
2015
21.5
k
0
2
Simple C program usi
#include < stdio.h >
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int
main(
int
argc,
char
* argv[]) {
char
chc, ok;
ok =
'n'
;
while
(ok ==
'n'
) {
puts(
"Menu"
);
puts(
"1. Create a directory"
);
puts(
"2. Delete a Directory"
);
puts(
"3. Show a Directory"
);
puts(
"4. Exit"
);
puts(
""
);
switch
(chc) {
case
'1'
:
puts(
"Choice is 1"
);
break
;
case
'2'
:
puts(
"Choice is 2"
);
break
;
case
'3'
:
puts(
"Choice is 3"
);
break
;
case
'4'
:
puts(
"Choice is 4"
);
break
;
default
:
puts(
"Invalid Choice"
);
ok =
'n'
;
return
0;
getch();
}
}
}
C Language Program
Switch Case
while Loop
Up Next
Simple C Program of While Loop and Switch Case