Docsity

C Programming Exercises, Quizzes of Computer Science

Toggle sidebar
bg1
1. Write a C program to that contains invoice method that compute the total
cost of the invoice by entering item price and item quantity using 5% sales
tax
2. Write a C program that contains a reverse method to reverse a number. For
example, reverse (1234) will output 4321.
3. Write a C program that contains a power method, ask the user for two
numbers (a base and an exponent) and then calculate the result of the base
raised to the power of the exponent using a loop statement.
4. Write a C program that contains a checkPrime method to check if a number is
prime or not
5. Write a C program that contains a swap function that takes two variables and
swap them. For example a=2, b=3 will be a=3, b=2
1

Partial preview of the text

Download C Programming Exercises and more Quizzes Computer Science in PDF only on Docsity!

  1. Write a C program to that contains invoice method that compute the total cost of the invoice by entering item price and item quantity using 5% sales tax
  2. Write a C program that contains a reverse method to reverse a number. For example, reverse (1234) will output 4321.
  3. Write a C program that contains a power method, ask the user for two numbers (a base and an exponent) and then calculate the result of the base raised to the power of the exponent using a loop statement.
  4. Write a C program that contains a checkPrime method to check if a number is prime or not
  5. Write a C program that contains a swap function that takes two variables and swap them. For example a=2, b=3 will be a=3, b= 1