Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.8 kB
1
Indexable
Never
// Name: Ally Jens
// Purpose: practicing the 3 kinds of loops
// Date: 9/22/23

#include <stdio.h>

int main (){
	
	char menuResponce;
	int numbers, oddOrEven, colum, row;
	
	printf("MENU\n");
	printf("(N)umbers\n");
	printf("(D)raw\n");
	printf("e(X)it\n");
	printf("Enter the character of your selection: ");
	
	scanf(" %c", &menuResponce);
	
	while (menuResponce != ' '){
		
		
		if (menuResponce == 'X'){
			break;
		} 
		else if(menuResponce == 'N'){
			scanf("%d", &colum);
	
			row = colum;

			for(int i = 0; i < colum; i++){
				for (int k = row - 1; k > 0; k--){
					printf(" ");
				
			
				}
				row = row - 1;
			
				for(int j = 0; j < i * 2 + 1; j++){
					printf("*");
				
		
				}
				
			printf("\n");
			}
		}
		else if(menuResponce == 'N'){
			do{
			printf("Please enter a number (0 to stop) ");
			
			scanf("%d", &numbers);
			
			oddOrEven = numbers % 2;
		
			
			if(oddOrEven == 0){
				printf("%d is even.\n", numbers);
			}
			else{
				printf("%d is odd.\n", numbers);
			}
	
		} while (numbers != 0);
		
		
		
		
		
		
		}
		else{
			printf("Please enter a valid option.");
			
		
		}
		
	
		
	

		//scanf("%d", &colum);
	
		//row = colum;

		//for(int i = 0; i < colum; i++){
		//	for (int k = row - 1; k > 0; k--){
		//		printf(" ");
				
			
		//	}
		//	row = row - 1;
		
		//	for(int j = 0; j < i * 2 + 1; j++){
		//		printf("*");
				
	
	
			
		//	}
				
		//	printf("\n");
		//}
		
		
		//do{
		//	printf("Please enter a number (0 to stop) ");
			
		//	scanf("%d", &numbers);
			
		//	oddOrEven = numbers % 2;
		
			
		//	if(oddOrEven == 0){
		//		printf("%d is even.\n", numbers);
		//	}
		//	else{
		//		printf("%d is odd.\n", numbers);
		//	}
	
		//} while (numbers != 0);
		
		
	
	}
	
	return 0;	
}













	return 0;
}