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
mash [69]
3 years ago
13

Assume there is a variable , h already associated with a positive integer value. Write the code necessary to count the number of

perfect squares whose value is less than h , starting with 1 . (A perfect square is an integer like 9 , 16 , 25 , 36 that is equal to the square of another integer (in this case 3*3 , 4*4 , 5*5 , 6*6 respectively).) Assign the sum you compute to a variable q For example, if h is 19 , you would assign 4 to q because there are perfect squares (starting with 1 ) that are less than h are: 1 , 4 , 9 , 16 .
_____________________________________________________________________________
Computers and Technology
1 answer:
Nataly_w [17]3 years ago
4 0

Answer:

pseudo code:

x=1

q=0

while x*x<h: {

x += 1}

q=x-1

complete code in C language

#include <stdio.h>

int main() {    

   int h=19;

  int q=0;

   int x=1;

  while ((x*x)<h){

 x += 1;

   }

   q=(x-1);

   printf("The sum of total perfect squares less than %d is: %d", h,q);

   

   return 0;

}

Explanation:

first '%d' in print statement refers to h and second '%d' in print statement refers to q

You might be interested in
Which statement best describes the problem statement below?
marta [7]

Answer:

B

Explanation:

This problem statement does not clearly define the issues.

7 0
2 years ago
Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
erastova [34]

Answer:

Mercury, rontgen rays, etc.

Explanation:

There are lots of answers to this question, hope these two help.

6 0
2 years ago
Computer programming is an essential skill for anyone wishing to pursue a career in cybersecurity. What might be a good ""first
Jet001 [13]

Answer:

Python is the correct answer.

Explanation:

Python Programming Language is might be good for those programmers who are beginners because the following Language is quite easy and simple to learn. When any programmer using Python Language for the programming then, they easily write their program because of its simplicity, it is easy and quick for learning language. This language creates program easy and short.

3 0
3 years ago
Create two classes. The first, named Sale, holds data for a sales transaction. Its private data members include the day of the m
olya-2409 [2.1K]

Answer:

A C++ program was used in creating two classes. the code is stated below.

Explanation:

Solution

The C++ program is executed below:

#include<iostream>

using namespace std;

//declare class (will be define later)

class Salesperson;

//class Sale

class Sale

{

  //private members of class

  private:

      string day;

      double amtOfSale;

      int salesPersonId;

 //public methods

  public:

      //constructor that takes day,amount of sale and salesPersonId as parameters

      Sale(string date,double sale,int id)

      {

          //set the private members to the initial values passed

          day=date;

          amtOfSale=sale;

          salesPersonId=id;

      }    

      //declare a friend function that takes objects of the two classes as parameters

      friend void display(Sale,Salesperson);

};  

//define class Salesperson

class Salesperson

{

  //private members of the class

  private:

      int salesPersonId;

      string lastName;    

  //public methods

  public:

      //constructor that takes name and id as parameters

      Salesperson(int id,string name)

      {

          //set the members of the class with the parameters passed

          salesPersonId=id;

          lastName=name;

      }  

      //declare a friend function that takes objects of the two classes as parameters

      friend void display(Sale,Salesperson);

};

//define the friend funtion

void display(Sale saleObj,Salesperson personObj)

{

  //display the sales info using the objects of the two classes

  cout<<"\nSale #"<<saleObj.salesPersonId<<" on "<<saleObj.day<<" for $"<<saleObj.amtOfSale<<" sold by #"<<personObj.salesPersonId<<" "<<personObj.lastName;

}  

int main()

{

  //create object for Sale class and pass default values

  Sale sObj1("12/25/2016",559.95,103);

  //create object for Salesperson class and pass default values

  Salesperson pObj1(103,"Woods");

 

  //create another object for Sale class and pass default values

  Sale sObj2("11/15/2016",359.95,106);

  //create another object for Salesperson class and pass default values

  Salesperson pObj2(106,"Hansen");

  //using the friend function dislay the sales info

  display(sObj1,pObj1);

  display(sObj2,pObj2);

  return 0;

}

4 0
3 years ago
Andy wants to touch up his holiday photographs because they appear too bright and the color is washed out. Which software applic
Veronika [31]
The application andy wants to use is adobe photoshop 
5 0
2 years ago
Other questions:
  • Create a funtion makeStudent(studentlist) where studentlist is your list of Student namedtuples The function should do the follo
    13·1 answer
  • Which option can Jesse use to customize her company’s logo, name, address, and similar details in all her business documents?
    7·1 answer
  • Is a network where connected devices are located within the same building.
    5·2 answers
  • Which window allows you to view and change your computer's system information and settings?
    9·2 answers
  • Check examples of a good work ethic. *
    6·1 answer
  • Who can search the internet and select element base on important words
    13·1 answer
  • HELP
    11·1 answer
  • Pls help will give brainlest!!! The image shows a line graph. Which scientist is most likely to use this visual aid in a present
    15·1 answer
  • A printer is considered to be in the category of
    5·2 answers
  • Consider the following declaration:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!