Tic-Tac-Toe Puzzle to place numbers
You have to place all the digits from 1 to 9 without repeating any number in a tic tac toe board..
So, that the numbers should add up to 15 whether you add the numbers in each row, column or diagonally.
i Have found out elements using C program. Ans is
4 | 9 | 2
———-
3 | 5 | 7
———-
8 | 1 | 6
Here is the code.
#include < stdio.h >
#include < conio.h >
int main() {
int size = 3;
int matrix[3][3]; // = {{4,9,2},{3,5,7},{8,1,6}};
int row, column = 0;
int sum, sum1, sum2;
int flag = 0;
printf("nEnter matrix : ");
for (row = 0; row < size; row++) {
for (column = 0; column < size; column++)
scanf("%d", & matrix[row][column]);
}
printf("Entered matrix is : n");
for (row = 0; row < size; row++) {
printf("n");
for (column = 0; column < size; column++) {
printf("t%d", matrix[row][column]);
}
}
//For diagonal elements
sum = 0;
for (row = 0; row < size; row++) {
for (column = 0; column < size; column++) {
if (row == column)
sum = sum + matrix[row][column];
}
}
//For Rows
for (row = 0; row < size; row++) {
sum1 = 0;
for (column = 0; column < size; column++) {
sum1 = sum1 + matrix[row][column];
}
if (sum == sum1)
flag = 1;
else {
flag = 0;
break;
}
}
//For Columns
for (row = 0; row < size; row++) {
sum2 = 0;
for (column = 0; column < size; column++) {
sum2 = sum2 + matrix[column][row];
}
if (sum == sum2)
flag = 1;
else {
flag = 0;
break;
}
}
if (flag == 1)
printf("nMagic square");
else
printf("nNo Magic square");
return 0;
}

Superb (Y)
code is not even compiling !
Your Answer
More puzzles to try-
Hindi Riddle
Chhote se Chintu Miyan, Lambi si Pooch. Jahan Jaye Chintu Miyan, Wahan Jaye Pooch. छोटे से चींटू मियाँ, लंबी सी ...Read More »Word of 12 alphabets riddle
I am a word of 12 alphabets My 12, 4, 7, 2, 5 are Eastern beast of burden. My 1, ...Read More »Form Triangles
Move any three matchsticks to form three triangles?Read More »Old valued more riddle
When he is young, sweet in the sun. When he is middle-aged, I make you gay. When he is old, ...Read More »Overtaking Boat
One boat is overtaking another. Which boat must give way?Read More »Hot Cup of coffee and cream riddle
You are served a hot cup of coffee and room-temperature cream at a restaurant. You want to wait a few ...Read More »Agents Puzzle
Three spies, suspected as double agents, speak as follows when questioned: Albert: “Bertie is a mole.” Bertie: “Cedric is a ...Read More »How does he successfully cross the river with his load?
A man needs to cross a river in a canoe. With him, he has a bag of grain, a chicken, ...Read More »Find celebrity in the party
There are (n+1) people in a party, they might or might not know each others names. There is one celebrity ...Read More »Matchstick arrangement reversal Riddle
As shown in the matchstick arrangement below, group of matchstick is making an arrow and pointing from left to right. ...Read More »The Wall Street Investor
An investor trading through a discount stock broker that charges $10.00 Dollars per transaction bought 200 shares of Vola Tile ...Read More »Programming logic puzzle
What will be the output of the following program?Read More »Letter E is lazy
Why is the letter E lazy ?Read More »Life in a forest riddle
A forest exists somewhere on Earth. This forest has no life except for trees. After a storm, a tree was ...Read More »Jacob’s Age
Jacob is 13 years old. His father John is 40 years old. How many years ago was Jacob’s father four ...Read More »Clock hand angle ridle
An analog clock showing 3:15. What is the angle between the minute hand and hour hand?Read More »What is the crime?
There is a certain crime, that if it is attempted, is punishable, but if it is committed, is not punishable. ...Read More »Geometric Analyzer
You have a glass of water that looks about half full. How can you tell, only using the glass of ...Read More »Large and Small
Large as a mountain, small as a pea, Endlessly swimming in a water less sea. What is it?Read More »Give the boy a Escape Plan
The picture above depicts a man handing from a tree branch with many different ways to die 1. a Snake ...Read More »