Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 4, Problem 2E
Explanation of Solution
The following program will display the values of n and n^2:
//include the header file
#include <stdio.h>
//definition of main method
int main (void)
{
//declare and initialize value to the variables
int n, n1 = 0;
//display the statements
printf ("The n and n^2 table is given below\n");
printf (" n | n^2\n");
printf ("-----------------\n");
//check the condition
for (n = 1; n <=10; ++n)
{
//calculate the "n1" v...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program to read and store four student’s name and their CGPA, sort them into an order name, based on CGPA from the smallest to the largest, then print them out. The student’s name and their CGPA values should be typed in by the user in response to a prompt message.
(Print a table) Write a program that displays the following table:a a^2 a^3 a^41 1 1 12 4 8 163 9 27 814 16 64 256
C++
Write a program to print a table for a number the number taken from user. The user entered number must be integer
Chapter 4 Solutions
Programming in C
Ch. 4 - Type in and run the nine programs presented in...Ch. 4 - Prob. 2ECh. 4 - A triangular number can also be generated by the...Ch. 4 - The factorial of an integer n. written n!, is the...Ch. 4 - The following perfectly valid C program was...Ch. 4 - A minus sign placed in front of a field width...Ch. 4 - A decimal point before the field width...Ch. 4 - Program 4.5 allows the user to type in only five...Ch. 4 - Rewrite Programs 4.2 through 4.5, replacing all...Ch. 4 - What would happen if you typed a negative number...
Knowledge Booster
Similar questions
- I want a python code to convert columns recording starttime, recording endtime, start and end from objects to datetime.arrow_forwardWrite a program to read and store four student's id number and their grade, sort them into an order their id, based on grades from the smallest to the largest, then print them out. The student's id number and their grade values should be typed in by the user in response to a prompt message.arrow_forwardWrite a program that sorts a table containing 200 random values. The program must display numbers in ascending and descending order.arrow_forward
- Write a annotation line by line (in paragraph) for the given code.arrow_forwardCreate a function in JAVASCRIPT which creates a table with Name and Age from the answers to the user prompts. The rows should be added automatically in case there is more answers.arrow_forwardWrite one line of code ONLY.Print the sorted list, num from maximum to minimum, using the list given below: num = [5, 1, 9, 4, 3] Just make sure to precisely match the output format below.Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course).Example Output[9, 5, 4, 3, 1]arrow_forward
- Computer Science Write a script file to make a table with x and y columns with 100 rows and plot the curve y as a function of x, where y(x)=sin(ax)-cos(bx). The values a, b, and range of x must be entered through input. Demonstrate that your program script file works for the case a is 8 and b is 2 and in addition plot x from 0 to 2π. Label the axis x and y of the figure.arrow_forwardWrite Python commands, within a print command, that output the following. (E.g. print(list(range(10))) ) With x,y as above find an expression for the vector cross product x×y.arrow_forwardWrite a C++ program in which user input the number and print a table upto 10.arrow_forward
- Write a python program based on the given dataset link: https://docs.google.com/spreadsheets/d/1Gx0xyAahcCW0eTy6I_ge35Ekkig-TdcM/edit?usp=sharing&ouid=109069606642686211088&rtpof=true&sd=true Return the total aquaculture production by region. You must disregard the Philippines in the region column. Use groupby to group rows according to the Region then apply the sum function to the Volume column to return total production per year. Sort the result base on Volume column.arrow_forwardcreate a function using java to check csv file for the total number of different phone numbersarrow_forwardCreate a string or list based on the values of other strings, such as dropdown in cells containing Arab countries, dropdown with other cells containing those cities. Countries are specified so that cities change when changing country, and this is done only by (indirect function). in excelarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage