Untitled
unknown
plain_text
a year ago
1.2 kB
3
Indexable
//Name: Travis Frisch //Purpose: project 2 //Date: 9/24/2023 #include <stdio.h> int main() { char option; int number; int row, totalRow, space, symbol; do { printf("MENU\n"); printf("(N)umber\n"); printf("(D)raw\n"); printf("e(X)it\n"); printf("Enter the character of your selection: "); scanf(" %c", &option); if (option=='N'||option=='n'){ do{ printf("Please enter a number (0 to stop): "); scanf("%d", &number); if (number % 2 == 0) { printf("%d is even.\n", number); }else { printf("%d is odd.\n", number); } }while(number != 0); } if (option=='D'||option=='d') { printf("Please enter a size larger than 2: "); scanf("%d", &totalRow); for (row=1; row<=totalRow; row++){ for(space=1; space<=(totalRow-row); space++){ printf(" "); } for(symbol=1; symbol<=((2*row)-1); symbol++){ printf("*"); } printf("\n"); } } else if(option != 'N'||option != 'n'||option!= 'D'||option!= 'd'||option!= 'X'||option!= 'x'){ printf("Invalid choice. Please enter N, D, or X.\n"); } }while(option!= 'X'&& option!='x'); return 0; }
Editor is loading...