Advertisement
Kenthris

Untitled

Apr 12th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. main()
  3. {
  4. int n=10;
  5. char yesno[3];
  6. do
  7. {
  8. printf("\n%s", "Do you want to play by defaut dimensions(10X10)?(yes/no)");
  9. scanf("%s", &yesno);
  10. if ((yesno!="yes")&&(yesno!="no"))
  11. {
  12. printf("\n%s", "Wrong input.Please choose between default dimensions(yes) and custom dimensions(no)");
  13. }
  14.  
  15. }while ((yesno!="yes") && (yesno!="no"));
  16. if (yesno=="no")
  17. {
  18. do
  19. {
  20. printf("\n%s", "Choose your own dimensions");
  21. scanf("%d", &n);
  22. if (n<5)
  23. {
  24. printf("\n%s", "Wrong input.Please choose a number >=5");
  25. }
  26. }while(n<5);
  27. }
  28. printf("\n%d", n);
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement