1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
KIM [24]
2 years ago
6

c Write a program that simulates a magic square using 3 one dimensional parallel arrays of integer type. Each one the arrays cor

responds to a row of the magic square. The program asks the user to enter the values of the magic square row by row and informs the user if the grid is a magic square or not. flowchart
Computers and Technology
1 answer:
Komok [63]2 years ago
7 0

Answer:

hope this helps and do consider giving a brainliest to the ans if it helped.

Explanation:

//program to check if the entered grid is magic square or not

/**c++ standard libraries

*/

#include<bits/stdc++.h>

using namespace std;

/**function to check whether the entered grid is magic square or not

*/

int isMagicSquare(int arr[3][3]){

  int i,j,sum=0,sum1=0,rsum,csum;

  for(i=0;i<3;i++){

      sum+=arr[i][i];

      sum1+=arr[i][2-i];

  }

  if(sum!=sum1){

      return 0;

  }

 

  for(i=0;i<3;i++){

      rsum=0;

      csum=0;

      for(j=0;j<3;j++){

          rsum+=arr[i][j];

          csum+=arr[j][i];

      }

      if(sum!=rsum){

          return 0;

      }

      if(sum!=csum){

          return 0;

      }

  }

  return 1;

}

/** main function to get user entries and

* call function

* and print output

*/

int main(){

  int i,j,arr[3][3]={0};

  for(i=0;i<3;i++){

      for(j=0;j<3;j++){

          cout<<"Enter the number for row "<<i<<" and column "<<j<<" : ";

          cin>>arr[i][j];

      }

  }

  int ret = isMagicSquare(arr);

  if(ret==1){

      cout<<"This is a Lo Shu magic square"<<endl;

  }

  else{

      cout<<"This is not a Lo Shu magic square"<<endl;

  }

  return 0;

}

You might be interested in
The first step when entering data is _
34kurt

Answer:

click on the cell

Explanation:

This is a little tricky. We need to first think of the column, then of row, and then click on the corresponding cell. And then we either start typing or move our mouse to highlight the cells. Hence, the correct option here is click on the cell.

3 0
2 years ago
In PKI, the CA periodically distributes a(n) _________ to all users that identifies all revoked certificates.
Trava [24]

Answer:

" CRL (certificate revocation list)" is the appropriate answer.

Explanation:

  • A collection of such subscriber bases containing accreditation or certification status combined with the validation, revocation, or outdated certification within each final customer is known as CRL.
  • Only certain subscribing workstations with a certain underlying cause authentication system should have been duplicated.
4 0
3 years ago
Which of the following is part of the cycle of dating violence
katen-ka-za [31]

Dating violence is a pattern of behavior where one person threatens or actually use

Physical, sexual, emotional, or verbal abuse to control his or her dating partner.

Examples of physical abuse are

Hitting, shoving, kicking

Examples of sexual abuse are

touches you when you don't want them to, forces you to watch dirty things,  

intercourse, fondling, exhibitionism, voyeurism, exploitation, prostitution & exposure to body parts.

Examples of verbal and emotional abuse

Insults, belittling, name calling, blaming, humiliation & false accusations.

Abuse is a

The deliberate infliction of harm or the threat of harm to a vulnerable person

Abusers in teen dating relationships, use behaviors of

Fear and intimidation

The only person that can choose to stop the violence is the

Abused.

Signs of an abused teen

Do poorly in school, have low self-esteem, may cry frequently, & may have trouble learning.

Abused teens even contemplate or attempt

Suicide

1 in 11 teens report being victims

Physical dating violence each year.

6 0
3 years ago
You have decided to install the DNS server role on Nano Server. What specific type of zone configuration is not supported when u
nadya68 [22]

Answer:Active Directory-integrated

Explanation: Active Directory-integrated is the service that is introduced by the Microsoft .This service provides the directory form for functioning in Windows. It serves the purpose of active directory(AD) transferring to the Dynamic web database. Whenever the user gets connected to any website, it provides validation to qualifications . So, it does not get support the specification when there is working of DNS.

4 0
2 years ago
A network administrator manages a network with 75 servers. At least twenty of those servers are approaching end of life but the
Gekata [30.6K]

Answer:

Virtual servers

Explanation:

4 0
3 years ago
Other questions:
  • How can you differentiate between standard and protocol? Write at least on example of each of these terminologies?
    12·1 answer
  • This common technique, employed at the edge of a network, eliminates the need for public IP addresses on a private network while
    8·1 answer
  • Try making a character (string) variable and a logical variable . Try creating a variable with a "missing" value NA. You can cal
    11·1 answer
  • Tamara has $500 she is looking to save for a class trip. She wants to earn the most possible interest and will not need access t
    7·1 answer
  • The person in charge of recording the sound should always
    15·1 answer
  • The labels button is found under the
    7·2 answers
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa
    5·1 answer
  • 4.2 lesson practice last one plzs help
    5·2 answers
  • It is a data being transported on a network​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!