0% found this document useful (0 votes)
5 views

Tutorial Questions for Arrays, Functions and Files

The document outlines a series of programming tasks in C, focusing on arrays, functions, and file handling. Tasks include creating functions for prime checking, rearranging arrays, matrix operations, and file I/O for student records. Each task is designed to enhance understanding of fundamental programming concepts.

Uploaded by

zabronjoshua003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Tutorial Questions for Arrays, Functions and Files

The document outlines a series of programming tasks in C, focusing on arrays, functions, and file handling. Tasks include creating functions for prime checking, rearranging arrays, matrix operations, and file I/O for student records. Each task is designed to enhance understanding of fundamental programming concepts.

Uploaded by

zabronjoshua003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Tutorial Questions for Arrays, Functions and Files

1. Write a C function isprime(num) that accepts an integer argument and returns 1 if the
argument is prime, a 0 otherwise. Write a C program that invokes this function to
generate prime numbers between the given ranges.
2. Write a program that arranges the positive and negative numbers in a one-dimensional array so
that all positive numbers come first and then all the negative numbers come without changing
the original sequence of the numbers.
3. Write a function check (x, y, n) that returns 1 if both x and y fall between 0 and n-1,
inclusive. The function should return 0 otherwise. Assume that x, y, and n are all of
type integers. Then, write a main program to test the function.
4. Write a program that accepts n integers into a one-dimensional array, calculates the
sum and average of the array elements, and displays the results.
5. Write a program to reverse the elements of a one-dimensional array without using
another array.
6. Write a program to find all duplicate elements in a one-dimensional array and print
them.
7. Write a program to add two 2x2 matrices and display the resultant matrix.
8. Write a program to subtract one 2x2 matrix from another and display the resultant
matrix.
9. Write two functions: one for converting Fahrenheit to Celsius and another for
converting Celsius to Fahrenheit. Test both functions in a program.
10. Write a function isLeapYear(int year) that checks whether a given year is a leap year.
Use it in a program to display all leap years in a given range.
11. Write a program to store student records (name, ID, and marks) in a file. Then, read the
data and display it in a formatted way.
12. Write a program to read the content of a text file and write it to another file.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy