XMPP JavaScript Library

Program to check if the given matrix is magic square or not

Program to check if the given matrix is magic square or not

1 /*Program to takes the the data of a 3x3 matrix and check if the given matrix is magic square or not*/
2 #include <stdio.h>
3 #include <conio.h>
4 int num[3][3];
5 int sum[8];
6 int r,c,i;
7
8 /*Function to take the value in matrix from user*/
9 void read_matrix()
10 {
11 for(r=0;r<3; r++)
12 {
13 for(c=0;c<3; c++)
14 {
15 printf("Enter value for %d %d::",r,c);
16 scanf("%d",&num[r][c]);
17 }
18 }
19 }
20
21 /*Function to print matrix and get the sum of rows,cols and diaglons*/
22 void print_calc_rows_cols()
23 {
24 int sum_row,sum_col,ctr=0;
25
26 /*Print the Matrix and get the sum of rows*/
27 for(r=0;r<3; r++)
28 {
29 sum_row=0;
30 for(c=0;c<3; c++)
31 {
32 printf("\t%d",num[r][c]);
33 sum_row=sum_row+num[r][c];
34 }
35 sum[ctr]=sum_row;
36 ctr++;
37 printf(":: %d",sum_row);
38 printf("\n");
39 }
40 printf("\t::\t::\t::\n");
41
42 /*Get the sum of columns*/
43 for(c=0;c<3;c++)
44 {
45 sum_col=0;
46 for(r=0;r<3;r++)
47 sum_col=sum_col+num[r][c];
48
49 sum[ctr]=sum_col;
50 ctr++;
51 printf("\t%d",sum_col);
52 }
53 printf("\n");
54
55 /*Get the sum of diagnols*/
56 sum[6]=num[0][0]+num[1][1]+num[2][2];
57 sum[7]=num[0][2]+num[1][1]+num[2][0];
58
59 }
60
61 /*Function to Check the sum of rows,cols and diagnols*/
62 char check_matrix()
63 {
64 char c;
65 for(i=0;i<3; i++)
66 {
67 if(sum[i]==sum[i+1])
68 c='y';
69 else
70 {
71 c='n';
72 break;
73 }
74 }
75 return c;
76 }
77
78 void main()
79 {
80 char c;
81 clrscr();
82 read_matrix();
83 print_calc_rows_cols();
84 c=check_matrix();
85
86
87 /*Print the result*/
88 if(c=='y')
89 printf("\nThis Matrix is a Magic Square");
90 else
91 printf("\nThis Matrix is Not a Magic Square");
92
93 getch();
94 }
Add Your Comment
   
    Yes! I want to receive all comments by email

  by yolo on 09-Apr-2019 02:53 pm

coach outlet store online

louboutin outlet

nike max

pandora jewelry outlet

fitflops outlet

ugg pas cher

rolex replica watches for sale

jordan pas cher

christian louboutin sale

coach outlet

prada outlet

kate spade outlet online

nike outlet

coach outlet sale

moncler sito ufficiale

ugg italia

kendra scott

hermes outlet store

mbt shoes

canada goose coats

ed hardy

adidas yeezy boost

coach canada outlet

polo ralph lauren outlet online

kappa clothing

yeezy shoes

gucci outlet store

ugg boots

michael kors outlet clearance

converse shoes

ralph lauren outlet online

coach outlet online

jordans

kobe shoes

air max 2017

yeezy shoes

coach outlet online

polo ralph lauren outlet

cazal outlet

coach outlet store

juicy couture

air jordan 14

christian louboutin shoes

birkenstock sandals

coach outlet online

coach outlet store

nike basketball shoes

pandora charms

kate spade outlet

ronaldo jerseys

red sox jerseys

cheap jordans

nike outlet

coach outlet store online

nike tn

adidas store

adidas ultra boost

canada goose coats

clarks shoes

saints jerseys

converse英国官网

coach factory outlet

christian louboutin shoes

yeezy shoes

seattle seahawks jersey

adidas nmd

cheap jordan shoes

coach outlet store online

canada goose coats

titans jersey

asics running shoes

coach outlet online

fjallraven backpack

nike outlet online

nike air force 1

pandora charms

cheap ray ban sunglasses

pandora outlet

nike outlet online

fitflops

michael kors outlet

pandora outlet

valentino outlet

kyrie 2

air max pas cher

nike air max 90

durant shoes

prada outlet

coach outlet store

uggs outlet

under armour shoes

kate spade outlet

true religion jeans sale

nike shoes

buffalo bills jersey

birkenstock shoes

ravens jerseys

y3 shoes

nba jerseys

kobe 12

true religion outlet store

christian louboutin outlet

birkenstocks

coach factory outlet online

coach outlet online

louboutin outlet

air max

fitflops sale clearance

true religion outlet

oakley sunglasses outlet

louis vuitton purses

north face outlet store

adidas outlet online

miu miu shoes

uggs canada

uggs outlet

mcm outlet store

yeti

coach outlet online

mbt shoes

birkin handbags

cheap jordan shoes

toms outlet online

christian louboutin shoes

coach factory outlet online

gucci outlet online

nike free flyknit

versace clothing

jordan 3

canada goose coats

valentino outlet store

air max plus

coach outlet online

coach outlet online

moncler jackets

ubiq shoes

coach factory outlet online

michael kors outlet

canada goose outlet

kate spade outlet store

coach factory outlet store

nike outlet store

jordan retro 11

ferragamo belts

hermes belt

discount oakley sunglasses

ralph lauren outlet

raiders jerseys

coach factory outlet

coach outlet online

adidas nmd runner

columbia outlet store

canada goose

michael kors outlet online

coach outlet online

nike tn

nike outlet store

jimmy choo shoes

moncler

louboutin shoes

christian louboutin outlet

jordan 12

canada goose coats

balenciaga triples

pandora jewelry

coach outlet online

fitflops sale clearance

north face outlet store

coach bags

cheap jordans free shipping

gucci outlet online

packers jersey

coach factory outlet

rolex replica watches

fila shoes

giuseppe zanotti shoes

michael kors outlet store

cowboys jerseys

kate spade outlet online

adidas shoes

true religion outlet

air jordan 4

yeezy shoes

uggs outlet

lacoste polo shirts

adidas ultra boost

pandora charms sale

retro 11

converse shoes

uggs

nike roshe run

ugg outlet

ralph lauren pas cher

air max

kate spade outlet online

fitflops

nike flip-flops

polo ralph lauren outlet

suicoke sandals

cheap air max

ugg boots outlet

snapback hats

revolution 3

david yurman

kate spade outlet online

coach factory outlet

valentino shoes

hydro flask cup

adidas superstars

coach outlet store

cheap snapbacks

pandora jewelry outlet

christian louboutin outlet

michael kors outlet online

coach outlet store

persol

north face outlet

coach factory outlet

nike outlet store

pandora charms

kate spade handbags

michael kors outlet clearance

seahawks jerseys

cheap nike shoes

michael kors outlet online

louis vuitton outlet online

fitflops sale clearance

air max 270

canada goose outlet store

prada outlet

vans shoes

jordan 4

coach outlet store

coach outlet online

cheap jordan shoes

adidas sneakers

coach outlet store online

fitflops sale clearance

ed hardy

coach factory outlet online

air jordan

nike air max 2018

maui jim

adidas yeezy shoes

mont blanc

pandora charms outlet

hydro flask sale

adidas outlet online

suicoke sandals

coach outlet online

the north face jackets

pandora jewelry

malone souliers shoes

toms shoes

true religion jeans

polo outlet

coach outlet clearance

cheap soccer jerseys

uggs outlet

uboutin shoes

coach factory outlet online

nobis jackets

moncler jackets

pandora jewelry outlet

christian louboutin outlet

christian louboutin outlet

ralph lauren polo

kendra scott

puma shoes

ralph lauren sale clearance uk

mulberry handbags

fjallraven kanken

cardinals jerseys

pandora jewelry outlet

coach factory outlet online

coach outlet online

nike outlet

coach handbags

pandora charms

louis vuitton

vibram fivefingers outlet

coach factory outlet online

ralph lauren outlet online

cheap handbags

asics shoes

air jordan uk

fred perry

cheap mlb jerseys

christian louboutin shoes

adidas yeezy boost

michael kors outlet online

air jordan

adidas neo shoes

pandora jewelry outlet

pandora charms sale clearance

balenciaga shoes

polo ralph lauren outlet online

air jordan shoes

michael kors outlet clearance

coach outlet store

ralph lauren uk

ugg boots clearance

louboutin outlet

nike roshe

pandora jewelry canada

manolo blahnik outlet

jaguars jersey

vans sneakers

gymshark sale

broncos jerseys

jordan shoes

mcm handbags

ugg outlet

ugg outlet store

ugg boots sale

michael kors handbags outlet

lebron 13

coach outlet store

birkenstock outlet store

kate spade outlet online

pandora charms

hermes bags

cheap snapbacks

kate spade handbags

nike blazer

indianapolis colts jerseys

pandora jewelry canada

swarovski jewelry outlet

pandora charms sale clearance

off white clothing

david yurman bracelet

uggs outlet

ralph lauren polo

ed hardy

lions jerseys

coach outlet store

oakley sunglasses outlet

true religion outlet store

stone island sale

coach outlet canada

maui jim sunglasses

air max

kobe 11

mac makeup

cincinnati reds jerseys

coach outlet online

kobe shoes

patriots jerseys

cnaada goose outlet store

coach outlet online

yeti cup

canada goose outlet

cubs jerseys

nike hyperdunk

coach handbags clearance

true religion outlet

pandora canada

curry 4 shoes

giants jerseys

off-white clothing

polo ralph lauren outlet

michael kors bags

pandora rings

polo outlet store

yeti tumbler

jordan shoes for sale

nike outlet store

philipp plein outlet

coach outlet online

persol sunglasses sale

ed hardy outlet

christian louboutin outlet

san diego chargers jerseys

coach purse

yeezy boost 350

moncler outlet online

coach factory outlet

givenchy handbags

twins jerseys

polo outlet store

nike air max schweiz

valentino

canada goose jackets

ugg outlet sale

ralph lauren uk

coach factory outlet online

cheap snapbacks

bathing ape

coach outlet online

true religion jeans

adidas shoes

coach outlet online

coach handbags

kevin durant shoes

michael kors factory outlet

adidas ultra boost

cheap ugg boots

coach outlet

jimmy choo shoes

prada outlet

adidas slides

true religion outlet

red bottoms

jordan shoes

chelsea jersey

houston texans jerseys

coach outlet store

mcm outlet

christian louboutin sale

air max 97

true religion jeans outlet

kate spade

cheap air jordans

pandora jewelry outlet

asics outlet

ferragamo outlet

pandora charms sale

denver broncos jersey

true religion jeans

miu miu handbags

dolce & gabbana Outlet

cheap jordans

pittsburgh steelers jersey

converse英国官网

michael kors outlet online

fitflop sale

tods outlet online

converse shoes

coach factory outlet

cheap nfl jerseys

ralph lauren uk

coach handbags

pandora charms sale clearance

coach outlet store online

nike outlet online

coach factory outlet online

ysl outlet

nike factory store

stone island sale

jordan 12

canada goose

nike kd 10

coach factorty outlet store

coach outlet online

gucci bags

mlb jerseys

nike factory outlet

ugg boots

coach outlet store online

true religion

kate spade outlet

pandora jewelry outlet

valentino outlet

coach outlet online

louboutin outlet

moncler pas cher

moncler jacka

gymshark clothing

supra shoes

yankees jerseys

polo ralph lauren outlet online

chaussures christian louboutin

coach outlet clearance

pandora charms

nike factory store

north face outlet online

louboutin pas cher

air jordan 3

fitflops sale clearance

nobis outlet

chi flat iron

kate spade outlet

ralph lauren polo

adidas nmd

coach outlet online

air huarache

cheap jordan shoes

coach outlet store online

fitflops

canada goose outlet store

uggs outlet online

camisetas futbol baratas

canada goose outlet store

coach handbags outlet

louboutin outlet

nike factory store

christian louboutin shoes

pandora outlet

prada outlet online

air max 2017

coach outlet clearance

ed hardy shoes

gucci outlet online

adidas nmd r1

moncler outlet online

michael kors outlet canada

coach outlet online

costa sunglasses sale

coach outlet online

david yurman

oakley sunglasses wholesale

christian louboutin outlet

coach outlet online

costa sunglasses sale

nike blazer

cheap mbt shoes

nike outlet store online

uggs outlet

david yurman jewelry

oakley sunglasses outlet

ray ban sunglasses

coach outlet online

toms outlet store

cheap maui jim sunglasses

nike outlet online

minnesota vikings jersey

air jordan shoes

coach factory outlet

coach outlet canada

ralph lauren outlet

air max

nike shoes

fivefingers shoes

coach outlet online

nike air force

coach handbags

nike outlet store

birkenstocks

adidas wings shoes

curry 5 shoes

coach outlet

prada sunglasses

kate spade outlet online

fitflops outlet

adidas yeezy boost 350

coach factory outlet

nfl jerseys

browns jerseys

tigers jerseys

cardinals jerseys

coach factory outlet online

pandora charms

louboutin outlet

kendra scott

mont blanc pen

yeezy shoes

fila

pandora charms outlet

persol sunglasses

gucci outlet online

nhl jerseys

air max outlet

mbt shoes outlet

stone island hoodie

mulberry bags sale

cheap jordan shoes

prada handbags

supreme clothing

michael kors outlet clearance

timberland boots

juicy couture

guess clothing

nba jerseys for sale

hydro flask sale

converse shoes

air jordan retro

true religion jeans

coach outlet online

coach outlet online

instyler ionic styler

air jordan retro

ferragamo outlet

jordans

michael kors outlet clearance

dolce & gabbana sunglasses

coach outlet online

adidas uk

ecco outlet

nike outlet online

toms

fitflops outlet

giuseppe zanotti outlet store

ugg

parajumpers jacket

louis vuitton outlet store

michael kors outlet canada

superdry clothing

pandora charms outlet

nike shoes

kate spade outlet online

mac cosmetics

ugg outlet clearance

david yurman

ugg outlet

coach factory outlet online

celine outlet

coach factory outlet

pandora jewelry store

salvatore ferragamo shoes

coach outlet canada

coach factory outlet online

coach factory outlet online

coach outlet store online clearance

nike outlet store

cheap jordan shoes

pandora charms sale clearance

rolex watches

true religion outlet

pandora sale clearance

moncler jacken

air jordan shoes

canada goose coats

ralph lauren outlet online

nike sneakers

mbt shoes

canada goose

air max 2015

kate spade outlet sale

celine outlet

moncler outlet online

polo ralph lauren outlet online

coach bags

ralph lauren outlet

adidas outlet online

ralph lauren outlet

bape hoodie

miu miu shoes

lacoste outlet

fjallraven kanken

michael kors outlet clearance

converse英国官网

le coq sportif

true religion jeans

marc jacobs handbags

polo ralph lauren outlet

coach outlet sale

coach outlet online

kate spade outlet

coach factory outlet

phillies jerseys

falcons jerseys

ed hardy outlet

coach outlet

canada goose sale

coach outlet online

coach outlet online

coach factory outlet online

nike sneakers

cheap air jordans

salomon shoes

air max shoes

soccer shoes

coach outlet online

louboutin outlet

canada goose outlet

gymshark sale

barcelona jersey

jets jersey

adidas outlet store

patriots jerseys

fred perry

pandora charms

coach outlet

adidas outlet

coach outlet online

cheap jordans

off white clothing

asics shoes

true religion

coach outlet online

cheap jordans for sale

coach factory outlet online

michael kors outlet store

louis vuitton outlet online

cheap oakley sunglasses

coach outlet store

coach factorty outlet store

ralph lauren outlet

louboutin outlet

coach outlet online

chrome hearts outlet store

true religion outlet store

off white shirt

hermes

ugg italia

coach factorty outlet online

true religion outlet store

converse shoes

nike free run

coach outlet store

fitflops

ralph lauren polo

cheap mlb jerseys

coach factorty outlet online

eagles jersey

ray ban sunglasses outlet

air max 2017

soccer jerseys

fitflops

coach factory outlet

mbt shoes

toms

michael kors outlet online

north face outlet

toms shoes

hermes bags

air jordan shoes

hydro flask lids

north face jackets

christian louboutin

coach outlet clearance

cincinnati bengals jersey

true religion outlet store

michael kors outlet clearance

coach outlet online

  • Reply
  •  0 Like
  •  0 Dislike
  • Report

  by marikani on 15-Dec-2015 03:50 pm
very bad.....how length it is......
  • Reply
  •  1 Like
  •  1 Dislike
  • Report
  by Dhananjay Shukla on 01-Oct-2015 12:02 am
Thaank U Soo Much
  • Reply
  •  1 Like
  •  1 Dislike
  • Report
  by charan on 28-Feb-2015 01:27 pm
but this pgm is long
  • Reply
  •  1 Like
  •  1 Dislike
  • Report
  by deepak dahiya on 07-Oct-2013 10:15 am
thank you sooooooo much buddy
  • Reply
  •  3 Like
  •  2 Dislike
  • Report
  by yashwi on 18-Apr-2013 10:06 am
modify the program using file concept....write a program to input a string and output the reverse string ..i.e. if "usf" is input , the program has a output "fsu"use pointer notation ...
  • Reply
  •  2 Like
  •  2 Dislike
  • Report
  by satheesh kumar on 16-Jul-2012 05:30 pm
thankz a lot friend for giving the solution:)
  • Reply
  •  3 Like
  •  2 Dislike
  • Report
  by um... on 28-Nov-2010 03:24 am
Does it check the numbers are different (1 through 9)?
  • Reply
  •  3 Like
  •  3 Dislike
  • Report
  by Sachin Puri on 29-Nov-2010 10:37 am
No it don't check that
  • Reply
  •  5 Like
  •  5 Dislike
  • Report
  by Bhrigu kumar das. on 11-Jun-2011 05:28 am
thanx for the program.it is good to me.i like it.
  • Reply
  •  3 Like
  •  122 Dislike
  • Report

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home2/sachinpu/public_html/pages/algorithm.php on line 33

Warning: include(ads/adbrite_300_250.php): failed to open stream: No such file or directory in /home2/sachinpu/public_html/pages/algorithm.php on line 33

Warning: include(): Failed opening 'ads/adbrite_300_250.php' for inclusion (include_path='.:/opt/cpanel/ea-php56/root/usr/share/pear') in /home2/sachinpu/public_html/pages/algorithm.php on line 33

About the author

Sachin Puri Hi, I am Sachin Puri, I am a Programmer. Programming is my work and it is the thing i like to do most in my free time.
You can catch Sachin Puri at