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
Nadusha1986 [10]
3 years ago
11

Write a program "addnumbers.c" where it takes as many arguments as the user includes as command line arguments and calculates th

e sum of all numbers entered, and prints it. You will find using function atoi() from stdlib.h library helpful, where it converts the string representation of an integral number to an int value. Compile it on a lab machine and run it using command line.

Computers and Technology
1 answer:
gogolik [260]3 years ago
8 0

Answer:

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char* argv[])

{

int first, second, total;

if (argc < 2)//checking if there are enough arguments

{

 printf("not enough values\n");

 return -1;//terminate program

}

total = 0;

for (int i = 1; i < argc; i++)

{

 //atoi convert a string into int. doing this to use operator

 total = total + atoi(argv[i]);//add current total to next argumment

}

printf("final total sum: %d\n", total);//printing final total

return 0;

}

Explanation:

For command line arguments you have to use command prompt. It varies depending on you machine and where you code is placed.

So, go to command line, called "command prompt" on Windows. This should open the black screen, also called the Terminal. A picture is attached in the answer. Then you have to NAVIGATE to the directory of your program. So, let's say your code is on your desktop. You will have to navigate to your desktop. To do this, type:

"cd Desktop", and press enter.

The picture of my process is attached below too.

Then, the program we have made is called addnumbers. we will type,

"addnumbers 10 20 30 40 50"

add numbers is the name of the program followed by arguments, separated with spaces.

You might be interested in
Which statements about grades are accurate? Check all that apply. Grades help indicate how well a student is understanding a cer
igomit [66]

Answer:

1, 2, 3 and 5.

Explanation:

6 0
3 years ago
Now let's create a memo. The memo should include all parts of a memo, and these parts should appear in the correct order. In you
netineya [11]

Answer:

MEMORANDUM

TO: Stacy Shoe, Allen Sock, and Emma Johnson.

FROM: Department of Information

DATE: 20th of December, 2019

SUBJECT: Computer Operations

The following is an illustration of how to start a computer and how to open an existing word processing document. For clarity and ease of understanding, this will be divided into two subheadings. All questions should be directed to the department of information.

START A COMPUTER

Step 1: Press the start button on the CPU tower.

Step 2: Wait while the computer boots. When the computer has finished booting, it will show a dialogue box that will ask for a user name and password.

Step 3: Enter your user name and password, then click

"OK."

Step 4: Your computer is now ready to use.

OPENING A WORD PROCESSING DOCUMENT

To open any word processing documents, you can use any of the options below.

1. Double-click file

In some cases, you can double-click a file to open it in Microsoft Word. However, the file will only open in Microsoft Word if that file type is associated with Microsoft Word. Word documents, like .doc and .docx files, are associated with Microsoft Word by default. However, web page files, text, and rich text format files are often not associated with Word by default, so double-clicking on these files may open in another program.

2. Right-click file and select program

For any file, you can choose the program to open a file with, including Microsoft Word.

Step 1: Right-click the file you want to open.

Step 2: In the pop-up menu, select the Open with option.

Step 3: If available, choose the Microsoft Word program option in the Open with menu. If Microsoft Word is not listed, select the Choose other app or Choose default program option, depending on the

Step 4: In the window that opens, find Microsoft Word in the program list and select that option. Microsoft Word should open and the file opened within Word.

3. Open within Microsoft Word

Follow the steps below to open a file from within Microsoft Word.

Step 1: Open the Microsoft Word program.

Step 2: Click the File tab on the Ribbon and click the Open option.

Step 3: If the Open window does not appear, click the Browse option to open that window.

Step 4: In the Open window, find and select the file you want to open in Microsoft Word. You may need to click the drop-down list next to the File name text field to change the file type to that of the file you want to select and open.

Step 5: Click the Open button at the bottom right of the Open window.

As stated above, all questions are to be directed to the department of information.

Thanks.

Explanation:

5 0
3 years ago
Blair is the director of information systems at a marketing firm. She creates a set of guidelines that dictate everything an emp
gizmo_the_mogwai [7]

Answer:

data

Explanation:

Because i said so

4 0
3 years ago
How do programmers recognise patterns, generalise and abstract information
Dima020 [189]

Answer:

Pattern recognition is the process of recognizing patterns by using machine learning algorithm. ... In a typical pattern recognition application, the raw data is processed and converted into a form that is amenable for a machine to use. Pattern recognition involves classification and cluster of patterns

Explanation:

4 0
2 years ago
1.Write the Qbasic program to find sum of any 10 different numbers.
dybincka [34]

Answer:

1.

DIM myArray(10) as INTEGER

LET A = 0

FOR I = 1 TO 10 STEP 2

INPUT “INPUT NUMBER”; myArray(i)

LET A = A + myArray(i)

NEXT  

PRINT A

END

2.

REM PROGRAM FOR CALCULATING THE SIMPLE INTEREST

CLS

INPUT “INPUT THE PRINCIPAL”; P

INPUT “INPUT THE TIME”; T

INPUT “INPUT THE RATE”;R

SI = P* T * R / 100

PRINT “SIMPLE INTEREST =”; SI

END

Explanation:

Please find the respective programs in the answer section.

4 0
3 years ago
Other questions:
  • What is the difference between a denial-of-service attack and a distributed denial-of-service attacks? which is potentially more
    10·1 answer
  • Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their
    14·1 answer
  • Which of the following expansion ports would be used to enable transfer of power, data, and video to peripheral devices on an Ap
    7·1 answer
  • Help! live preview in brackets is not working
    8·1 answer
  • PowerPoint allows you to input files from variety of sources, such as Microsoft access.
    6·1 answer
  • Write a program to enter a number and test if it is greater than 45.6. If the number entered is greater than 45.6, the program n
    10·1 answer
  • What word can you type using only the left home row keys and the right reach keys?
    6·2 answers
  • The Table Design and Layout tabs are available under the
    13·2 answers
  • GOOD EVENING, FRIENDS, I WANT TO ASK ON THE ACCOUNT OF HIS NAME‏BENJEMIN360 . THIS ANSWERS ARE VERY WONDERFUL, BUT I CAN'T COMMU
    6·1 answer
  • With _____ technology, a web server delivers information to users, who have signed up for the service, instead of waiting for th
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!