Are any values of x also illegal?

Assignment Help C/C++ Programming
Reference no: EM131149123

Q ) Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression.

1+x+x2+x3+....+xn For example: if n is 3 and x is 5, then the program computes 1+5++25+125. Print x,n, the sum Perform error checking. For example, the formula does not make sense for negative exponents - if n is less than 0.

Have your program print an error message if n<0, then go back and read in the next pair of numbers of without computing the sum.

Are any values of x also illegal? If so, test for them too.

Reference no: EM131149123

Questions Cloud

Functions to perform the operations : Write a C program that uses functions to perform the following operations: To delete n characters from a given position in a given string.
Construct a genogram of your own family : The instructor will assign you a partner in the class to exchange ideas about the creation of the genogram including structure, notations, etc. Write an essay of 500-750 words, reflecting what you learned. Discuss any relevant insights regarding you..
Write a c program that displays the position or index : Write a C program that displays the position or index in the string S where the string T begins, or -1 if S doesn't contain T.
What advantages of practicing within an integrated framework : What are two advantages and two disadvantages of practicing within the framework of one specific theory as opposed to developing a more integrative approach consisting of several therapies? Give a detailed description and rationale for both sides.
Are any values of x also illegal? : Have your program print an error message if n
Are individuals equally able to control each channel : Individuals make different attributions based on their interpretation of both verbal behavior and nonverbal behavior since the kinds of information received from each communication channel differ. Are individuals equally able to control each chann..
Write a c program to find the 2s complement : Write a C program to find the 2's complement of a binary number.
Write a c program to merge two files : Write a C program to merge two files into a third file(i.e. the contents of the first file followed by those of the second are put in the third file)
Program that uses non recursive function to search : Write a C program that uses non recursive function to search for a key value in a given sorted list of integers usingt Binary search

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Review a phonebook program

Add a command ‘d' for delete to delete an entry corresponding to a name typed by the user. Add a command "u" to allow a user to update (edit) one or more of the fields in the phonebook

  Discuss inheritance and namespaces

Discuss Inheritance and Namespaces. Discuss with examples the operation of displaying nodes in the linked list. Discuss with examples the operation of inserting nodes in the linked list.

  A list of toppings should be shown on the screen as a menu

Write a menu-driven C++ program that allows a user to select from the following items: Pizza, Cheeseburger, and Hot Dog. Pizza should be represented by the integer value 1. Cheeseburger should be represented by the integer value 2.

  Differences between if/else selection and switch selection

What do you need to analyze when directing the flow of information in each case?

  Define the relationship between programming lang and app

Compare and contrast object-oriented technology and structured programming so that the managers of the organization can make the best decision for their business.

  What is the value of i after the following loop

Determine the truth of the following statement: (5 > 4) && ( (2 > 6) || !(0 > 1) ). What is the value of i after the following loop? int i = 5; while( (i % 3) != 0) { i++ ;}

  Fault and performance management in lan

Monitoring and analysis is an important part of fault and performance management in LANs and other networks. Discuss the conditions that can adversely affect network performance, and the current tools (software and hardware) as well as procedures..

  Write a function that compares two stacks for equality

Write a function that compares two stacks for equality. The function takes two stacks as parameters and returns true if they are identical.  The stacks should remain unchanged after the function returns to the calling program.

  Describe what an attribute or data member of a class

Analyze a basic set of requirements for a problem - Describe what an attribute or data member of a class - Distinguish between pass-by-value and pass-by-reference

  Execute the next line which is enter your last name

C++ in VS and I'm trying to run the following program. As soon as I put in my name after the 2nd cout statement, the program ends.

  Program that is supposed to search message.txt and print out

I'm having trouble with a program that is supposed to search message.txt and print out the message. i will upload instructions. We must use functions, and we were not instructed on how to search char arrays for this purpose and I am lost. Your hel..

  Store the numbers in an array

You need to write a program that will read the file 'unumbers.dat', store the numbers in an array, and then prompt the user to search the list for a number.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd