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
Virty [35]
3 years ago
15

NOTE: in mathematics, the square root of a negative number is not real; in C therefore, passing such a value to the square root

function is an error. Given a double variable named areaOfSquare write the necessary code to read in a value, the area of some square, into areaOfSquare and print out the length of the side of that square. HOWEVER: if any value read in is not valid input, just print the message "INVALID".
Computers and Technology
1 answer:
Tanya [424]3 years ago
4 0

Answer:

# include<math.h>

# include<stdlib.h>

# include<stdio.h>

int main()

{

    int choice;

    double area;

    printf("Enter the area of Square:");

    scanf("%lf", &area);

    printf("Enter the choice: 1, 2:");

    scanf("%d", &choice);

    switch(choice)

    {

        case 1:if(area<0.00)

                        {

                        printf(" INVALID");

                        break;

                        }

                      else

                        {

                        printf("side of square: %lf", sqrt(area));

                        break;

                       }

                       break;

        case 2: break;

    }

return 0;

}

Explanation:

Here, if area is less than 0 then invalid message is printed out. And if area is more than 0 then the sqrt is calculated and the side of a square length is being printed out. And that is what is required. lf is for double. And math.h is included to make use of the sqrt function.

You might be interested in
Write the program to solve quadratic equations, but if the discriminant is negative, output
Firdavs [7]

Answer:

PROGRAM  QuadraticEquation Solver

  IMPLICIT  NONE

REAL :: a, b, c ;

  REA :: d ;

  REAL  :: root1, root2 ;

//read in the coefficients a, b and c

  READ(*,*)    a, b, c  

  WRITE(*,*)   'a = ', a

  WRITE(*,*)   'b = ', b

  WRITE(*,*)    'c = ', c

  WRITE(*,*)

// computing the square root of discriminant d

  d = b*b - 4.0*a*c

  IF (d >= 0.0) THEN              //checking if it is solvable?

     d     = SQRT(d)

     root1 = (-b + d)/(2.0*a)     // first root

     root2 = (-b - d)/(2.0*a)     // second root

     WRITE(*,*)  'Roots are ', root1, ' and ', root2

  ELSE                            //complex roots

     WRITE(*,*)  'There is no real roots!'

     WRITE(*,*)  'Discriminant = ', d

  END IF

END PROGRAM  QuadraticEquationSolver

8 0
4 years ago
What are possible consequences for cyberbullying?
MrRa [10]

Answer:

Victims of cyberbullying are more likely than their peers to abuse alcohol and drugs, have physical and emotional health issues, and may suffer from low self-esteem. Poor grades in school is another consequence of cyberbullying that can also be accompanied by an attempt by the victim to avoid other children by refusing to go to school.

Explanation:

8 0
3 years ago
Read 2 more answers
What are the different components of the cloud architecture? The of the cloud architecture is the cloud, which is a collection o
tester [92]

Answer:

Cloud Architecture is basically consist of front end platform, back end platform, cloud and a network.

Explanation:

Front end platform consists of client and mobile device. while Back end platform consist of server and storage. The Cloud is the collection of data and Network is consist of Intranet and internet.

All the above mentioned components combined together to complete the architecture of cloud.

3 0
3 years ago
there is a structure called employee that holds information like employee code, name, date of joining. Write a program to create
Sever21 [200]

Answer:

The program in C is as follows:

#include<stdio.h>

#include<conio.h>

struct employee{

char empname[50]; int empcode, day,mon,yr;

}employees[30];

int main(){

int total;

printf("Numbers of Employees : "); scanf("%d",&total);

for(int kt=0;kt<total;kt++){

printf("Employee Code : "); scanf("%d",&employees[kt].empcode);

printf("Name: "); scanf("%s",employees[kt].empname);

printf("Date of Joining [dd mm yyyy]: "); scanf("%d%d%d",&employees[kt].day,&employees[kt].mon,&employees[kt].yr); }

int year;

printf("\nCurrent Date [Year only]: "); scanf("%d", &year);

printf("Code\t\t\t Name\t\t\t Date of Joining\n");

for(int kt=0;kt<total;kt++)

if((year - employees[kt].yr) >= 15)

printf("%d\t\t\t %s\t\t\t %d/%d/%d\n",employees[kt].empcode,employees[kt].empname, employees[kt].day,employees[kt].mon,employees[kt].yr);

}

Explanation:

See attachment for explanation where comments were used to explain some lines

Download txt
3 0
3 years ago
How do you chose a profile pic on brainly?
pogonyaev

Answer:

Go to the profile page and click on the profile image

6 0
3 years ago
Other questions:
  • The information gathering technique that enables the analyst to collect facts and opinions from a wide range of geographically d
    11·1 answer
  • Based on the Pizza database you imported, complete the SQL statement below to add the column VIP to the customers table. The cus
    8·1 answer
  • What will the following segment of code output if 11 is entered at the keyboard?
    12·1 answer
  • Which page feature is used in long documents to assist readers in quickly finding information in the document without having to
    11·2 answers
  • Write a C program that will load entries from a file containing details of books and prints them.
    14·1 answer
  • In order for storage devices to be prepared for use, they must be ____________ Group of answer choices pre-prepared loaded initi
    11·2 answers
  • Do a comment if u hate me.or think im d.U.m b. add a answer if u dont care. thank all the asnwers or report for saying i dont ex
    9·1 answer
  • Based on what you know about the Sort and Find functions, return to the database file to determine the answers to the following
    7·2 answers
  • What is a common misconception about Agile and DevOps?
    9·1 answer
  • List four safety factors that must be considered when building mine shaft headgear model
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!