Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c please 14.23 Lab 6 Group Sums Name this program groupsum.c. This program accepts two command-line arguments: input filename positive integer group size s

in c please

14.23 Lab 6 Group Sums

Name this program groupsum.c. This program accepts two command-line arguments:

input filename

positive integer group size s

Example: ./a in.txt 3

The input file contains only integers. Write a program that sums integer groups of size s from the input file and outputs these group sums to the terminal. If there are not enough numbers in the file to complete the final group, ignore them and do not print a sum for this partial group.

There will be less than 100 numbers in the input file.

End your input files with an empty newline.

You can get partial credit for this problem if the partial group is printed at the end.

Examples

in.txt

1 2 3 4 6 5 10 20 30 1 1 1 1 2 
./a in.txt 3 6 15 60 3 
Explanation: 1 + 2 + 3 = 6 4 + 6 + 5 = 15 10 + 20 + 30 = 60 1 + 1 + 1 = 3 1 and 2 are ignored as they are not part of a full group of size 's' (3) 
./a in.txt 2 3 7 11 30 31 2 3 

Note: You cannot test your code in the ZyBooks' browser window fully as you cannot create input files. in.txt exists.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

=+ How well do you think you could do your job?

Answered: 1 week ago