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]
4 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]4 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 of these describes a property of all elements A. all elements have six electrons B. all elements are pure substances C. al
sergiy2304 [10]
Im guessing the answer would either B or C
3 0
3 years ago
Write a computer program to tell if the number is even or odd please
vovikov84 [41]
There you go :) Written in C# you can add using tags yourself I believe

3 0
3 years ago
I have a real struggle when it comes to working with strings, whether they're arrays or pointers to strings, and I'm lost cause
neonofarm [45]
In C, you deal with a string always via a pointer. The pointer by itself will not allocate memory for you, so you'll have to take care of that.

When you write char* s = "Hello world"; s will point to a "Hello world" buffer compiled into your code, called a string literal.

If you want to make a copy of that string, you'll have to provide a buffer, either through a char array or a malloc'ed bit of memory:

char myCopy[100];
strcpy(myCopy, s);

or 

char *myCopy;
myCopy = (char*)malloc( strlen(s) + 1 );
strcpy(myCopy, s);

The malloc'ed memory will have to be returned to the runtime at some point, otherwise you have a memory leak. The char array will live on the stack, and will be automatically discarded.

Not sure what else to write here to help you...
6 0
3 years ago
Write a program to prompt the user to enter a fist name, last name, student ID and GPA. Create a dictionary called Student1 with
andrew-mc [135]

Answer:

Answered below

Explanation:

#Program is written in Python

first_name = input ("Enter first name: ")

last_name = input ("Enter last name:")

student_id = int(input("Enter your ID"))

gpa = float(input ("Enter your GPA: "))

student1 = {}

student1["first_name"] = first_name

student1["last_name"] = last_name

student1["student_id"] = student_id

student1["gpa"] = gpa

//Repeat same code for student2 and student3

class_list = {"student1": {"first_name":"joy","last_name":"Son","student_id":"1","gpa":"3.5"},

#Fill in for student 2 and 3}

#To remove GPA for all students

del class_list["student1"]["gpa"]

del class_list["student2"]["gpa"]

del class_list["student3"]["gpa"]

print(class_list)

4 0
3 years ago
A speciality sports shoe manufacturer from a small city wants to estimate the size of the niche market. The manufacturer does so
svp [43]

Answer:

The shoe manufacturer is first looking at the census of the city. And in marketing, we first look at the current customer base, which is the data with us. And then we look at the product/service and choose the correct demographics to target and consider the psychographics of the target. And finally, we evaluate our decision. Or we can also have a look or consider the census of the city as well. And census of the city gives a clear indication that who they are and where they are heading to, The government determines where to invest the funds, and also the companies with the help of the census, and it is the source information or the primary source. Hence, it's true to say that that shoe manufacturer is making use of the source information.

Explanation:

Please check the answer section.

5 0
3 years ago
Other questions:
  • Nicole wants to create a database to collect information about sales transactions. She would like to use the database to look up
    6·2 answers
  • What would you use to compare two date ranges in a report?
    9·1 answer
  • HELP ASAP U GET BRAINLIEST
    15·2 answers
  • Describe how you believe technology will impact our society in 50 years.
    6·1 answer
  • What type of result does the MATCH function, when used on its own, return?
    5·1 answer
  • PLEASE HELP! One of the nice byproducts of joining a club, organization, community service project, or service learning project
    6·1 answer
  • Your friend Margo is considering what type of display to purchase with her new desktop computer and she asks you for advice. You
    14·1 answer
  • True or false? Resistors regulate and limit electrical current. A. True B. False
    7·2 answers
  • Compare and contrast Charles bebbage and Blaise Pascal inventions<br>​
    14·1 answer
  • __________ is a software-enabled technique that can change the hardcoded mac address to any mac address and thus overcome mac ad
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!