Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise Objectives Declare, initialize, manipulate, and pass an array of integers. Problem Description Write a C program to calculate the summation of 7 numbers. Implement

Exercise Objectives
Declare, initialize, manipulate, and pass an array of integers.
Problem Description
Write a C program to calculate the summation of 7 numbers. Implement the program using the following steps:
Define a function void PrintWelcome 0 used to print the welcome statement.
Define a function int CalcSum (int a [], int size) that receives an integer array and its size as parameters, calculates the sum of the array, and returns the sum.
In main:
> Call function PrintWelcome() to print the welcome statement.
> Declare an integer array numbers[] with a size of 7 using #define and initialize it with zeros.
> Use a for loop to ask the user to input 7 numbers and store them in the numbers[] array.
> Call the CalcSum () function to calculate the sum of the numbers[] array.
> Display the calculated summation on the output.
Note: You must adhiere to the following sample.
Sample Output
Exercise 2
Exercise Objectives
Use a counter and while loop.
Problem Description
Create a c program that asks the user to enter his name using an array of characters:
Define a function void PrintWelcome 0 used to print the welcome statement.
Define a function int get_length(int a [], int size) that receives the array and its size and returns the length of the name to the main (using a while loop).
Define a function void Reverse_Name(int a[], int size) that receives the array and its size and prints the reverse name (using a while loop).
In main:
> Call function PrintWelcome() to print the welcome statement.
> Create an array of char with size 25 and initialize it to NULL
> Ask the user to input his name.
> Call function get_length .
> Call function Reverse_Name.
Sample OutputWrite a C program that performs the following steps:
Define a function void PrintWelcome() to print a welcome message to the user.
Define a function int max (int arr [], int size) that receives an array of integers and its size as input and returns the maximum value in the array.
Define a function int isPrime(int num) that receives an integer as input and returns 1 if the number is prime, and 0 otherwise.
In main:
> Call the PrintWelcome0 function to print the welcome message.
> Declare an integer array numbers with a size of 5 using #define and initialize it with zeros.
> Use a for loop to ask the user to input 5 numbers and store them in the numbers array.
> Call the max () function on the numbers array and print the maximum value.
> Use a for loop to check each number in the array using the isPrime0 function and print whether each number is prime or not.
Note: You must adhere to the following sample.
Sample Output
image text in transcribed

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 Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Solve the following 1,4 3 2TT 5x- 1+ (15 x) dx 5X

Answered: 1 week ago