def main (): # The main function introduction = intro() board = create_grid() pretty = printPretty(board) symbol_1, symbol_2 = sym() full = isFull(board, symbol_1, symbol_2) # The function that starts the game is also in here. def intro (): # This function introduces the rules of the game Tic Tac Toe print ( "Hello! Welcome to Pam's Tic Tac Toe game!" ) print ( " \n " ) print ( "Rules: Player 1 and player 2, represented by X and O, take turns " "marking the spaces in a 3*3 grid. The player who succeeds in placing " "three of their marks in a horizontal, vertical, or diagonal row wins." ) print ( " \n " ) input ( "Press enter to continue." ) print ( " \n " ) def create_grid (): # This function creates a blank playboard ...
PROGRAM: #include <stdio.h> int main () { int i = 2 , n , p , a ; printf ( "Enter a number: " ); scanf ( " %d " , & n ); // for (i = 2; i< n; i++) // { // p = n%i; // if (p==0) // { // a = 1; // } // else // continue; // } while ( i < n ) { p = n % i ; if ( p == 0 ) { a = 1 ; break ; } i ++ ; } if ( a == 1 ) printf ( "it is not a prime number"...
PROGRAM: #include <stdio.h> int main () { int n ; // do - while loop is to do something again and again do { printf ( "enter the number- \n " ); scanf ( " %d " , & n ); } while ( n < 1 ); for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { printf ( "*" ); } printf ( " \n " ); } } OUTPUT: enter the number- 5 ***** ***** ***** ***** *****
Comments
Post a Comment