Docsity

Programming I Exercises: A Comprehensive Guide to C Language Fundamentals, Ejercicios de Programación C

Toggle sidebar
bg1
1
DEPARTMENT OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGIES
PROGRAMMING I - Course 2019/2020
Exercises 4
1. Design and implement a program in C language, which exclusively using
subprograms, ask integers from the keyboard and are storing them in an array
of 10 elements, then the screen showing the contents of the array created.
2. Design and implement a program in C language, using only subprograms, that
requested by keyboard animal names and are filling an array of 7 elements then
displaying them on screen properly.
3. Design and implement a program in C language, which exclusively using
subprograms, calculate the sum of the elements of an array of real numbers
provided by the user, considering maximum 30 elements.
4. Design and implement a program in C language to store in memory the hours
of study a student devoted to a particular subject for a week. Request data
appropriately to the user, calculate and display the average daily hours spent on
that subject. Also, indicate the day that has been more applied (maximum hours
of study) and less (fewer hours studying).
5. Design and implement a program in C language to store temperatures (Celsius)
registered in a city for a day, hour by hour (0-23). Enter temperatures from data
provided by the user, orderly display the temperatures, and calculate and display
on screen the maximum, minimum and mean temperatures.
6. Design and implement a program in C language, based on the structure created
in the previous exercise, create a system for storing temperatures (Celsius)
registered in a city for a week (each hour, each day) Enter the temperatures
requesting data appropriately to the user. Calculates and displays to the screen
the daily average temperatures, hourly average temperatures and weekly average
temperature.
7. Design and implement a program in C language where the user inputs the
weekly budget (in euros) and daily expenses in different concepts (eg:
transportation, food and leisure) for a week. Calculates and displays on screen
the total expenditure of the week, the weekly average daily spending and
spending on the various concepts and % of the weekly budget spent each day.
pf3
pf4
pf5

Vista previa parcial del texto

¡Descarga Programming I Exercises: A Comprehensive Guide to C Language Fundamentals y más Ejercicios en PDF de Programación C solo en Docsity!

DEPARTMENT OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGIES PROGRAMMING I - Course 2019/

Exercises 4

  1. Design and implement a program in C language, which exclusively using subprograms, ask integers from the keyboard and are storing them in an array of 10 elements, then the screen showing the contents of the array created.
  2. Design and implement a program in C language, using only subprograms, that requested by keyboard animal names and are filling an array of 7 elements then displaying them on screen properly.
  3. Design and implement a program in C language, which exclusively using subprograms, calculate the sum of the elements of an array of real numbers provided by the user, considering maximum 30 elements.
  4. Design and implement a program in C language to store in memory the hours of study a student devoted to a particular subject for a week. Request data appropriately to the user, calculate and display the average daily hours spent on that subject. Also, indicate the day that has been more applied (maximum hours of study) and less (fewer hours studying).
  5. Design and implement a program in C language to store temperatures (Celsius) registered in a city for a day, hour by hour (0-23). Enter temperatures from data provided by the user, orderly display the temperatures, and calculate and display on screen the maximum, minimum and mean temperatures.
  6. Design and implement a program in C language, based on the structure created in the previous exercise, create a system for storing temperatures (Celsius) registered in a city for a week (each hour, each day) Enter the temperatures requesting data appropriately to the user. Calculates and displays to the screen the daily average temperatures, hourly average temperatures and weekly average temperature.
  7. Design and implement a program in C language where the user inputs the weekly budget (in euros) and daily expenses in different concepts (eg: transportation, food and leisure) for a week. Calculates and displays on screen the total expenditure of the week, the weekly average daily spending and spending on the various concepts and % of the weekly budget spent each day.
  1. Design and implement a program in C language, by sequential search allow finding the lowest and the highest index were a given X can be found into an array of integes. The program should allow the user to properly enter the array of integers and ask for the value you want to find.
  2. Design and implement a C language program to build an array from integers provided by the user (maximum 20 elements), and then replace the even numbers by the square and odd numbers by the integer part of the square root of its absolute value. Display for both the original array as the result of the above operations.
  3. Design and implement a C language function that receives two unsorted arrays of integers of 50 elements each and return an ordered array with all the elements from both arrays.
  4. Design and implement a recursive function in C language that returns the sum of the elements of an array of integers.
  5. Design and implement a C language function to indicate whether an array of integers is palindromic.
  6. Design and implement a program in C language to properly enter a NxN array of integers (0 <N <20), the appropriately displayed on the screen (matrix format) and show the maximum and the minimum values and their positions/indexes.

Enter the elements of the array separated by spaces to end: 1 2 3 5 3 2 3 4 5 6 3 1 2 3

Enter the number you want to search: 3 The number 3 appears first in position 3 and the last at position 14. Enter the number you want to search: 4 Numeral 4 appears for the first and only time in the position 8. Enter the number you want to search: 9 No. 9 does not appear in the array.

  1. Design and implement a C-language function that receives two arrays of 30 disordered real numbers each, and return an ordered array with elements of the two.
  2. Design and implement a C-language function that receives two arrays of characters, without ending in '\0' (are not chains); both arrays are not ordered and they have 100 elements each. Return an ordered array with elements of the two.
  3. Design a structure to store information about 20 employees of a workshop. If the employee's office will have a phone number, if the driver will be assigned the registration number of a vehicle, and if he will be a technician, a barcode of from a computer will be assigned. You must know the name, date of birth, type of job and educational level of all workers.
  4. Design and implement a C language program to read a sentence from the keyboard (character string to EOL), and determine the frequency of occurrence of each vowel respect to the total characters of the phrase.
  5. Design and implement a program in C language to read a sentence (maximum 100 characters) and provide the user the ability to replace any word of those introduced by a synonym. Display the original sentence and the sentence after carrying out the replacement.
  6. Design and implement a program in C language to read a sentence (maximum 100 characters) and then showing every word of it followed by the number of letters that compose it. For simplicity, assume that the words can be separated only by spaces, commas or periods.

Enter a sentence of a maximum of 100 characters: Good morning, let us begin. Power up your device.

Good 4 morning 7 let 3 us 2 begin 5 Power 5 up 2 your 4 device 6

  1. Design and implement a program in C language to read a phrase (sequence of characters to end of line), replace all sequences of two or more spaces with a single space and the show the modified phrase.
  2. Design a function that returns to reverse the string received as parameter.
  3. Design a function that adds two numbers of 2500 digits each.
  4. Implement VAL boolean function (tstring string) which returns TRUE if the string it can convert 9 characters to real number, and FALSE otherwise.
  5. Implement a function to receive a car registration, age and the name of a driver and return TRUE if the sum of the numbers of the car registration is equal to the age of the driver and if letters of the car registration coincide with the initials of the name and surname of the vehicle owner.
  6. Implement a program that reads a phrase, character by character from the keyboard, and calculate and display the number of letters, digits and other characters.
  7. Implement a program that reads a minimum of 20 words from the keyboard until the character and store into an array the first 20 words. For each word stored in the array it should include the following information:

a) If the word is uppercase; b) Number of vowels; c) Number of times an word appears in the text; d) Frequency of characters that make up each word.

  1. Implement a program to save into a vector the European capitals and its population. This program should allow displaying the existing capitals in an ordered array, both by capital name and by population.
  2. Implement a program that ask for five integers (ni > 0) and display each number and factorial decomposition. Use a suitable data structure to store both the numbers and decompositions.