

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Loop Statements Exercise 1: Write a program in C to read n numbers from keyboard and find their sum and average. Exercise 2: Write a program in C to display the multiplication table of a given integer n (n from 2 to 100, ask user re-enter if n is out of this range) Exercise 3: Write a C program to calculate the factorial of a given number Exercise 4: Write a C program to determine whether a given number is prime number (số nguyên tố) or not. Định nghĩa số nguyên tố: Là số số nguyên dương > 1 và chỉ chia hết cho 1 và chính nó. Ví dụ: 2, 3, 5, 7, 11, ….. Exercise 5: Write a program in C to find the prime numbers within a range of numbers. The program will ask user input starting and ending numbers of range and display the prime numbers in this range. Example: Input starting number of range: 10 Input ending number of range: 30 The prime number between 10 and 30 are : 11, 13, 17, 19, 23, 29 Exercise 6:
Write a program in C to display the first n terms of Fibonacci series. Fibonacci series: 1 1 2 3 5 8 13 ..... Công thức truy hồi của dãy fibonacci có dạng: f(n) = f(n-1) + f(n-2) Với f(1) = 1; f(2) =1; Exercise 7: Write a program in C to find the numbers and sum of all integer between a and b (a and b are entered from keyboard) which are divisible by 7 Exercise 8: Write a c program to input n positive integer numbers, print their sum and largest number Exercise 9: Write a c program to input an integer number which should be greater than 10 and less than 100, number check should be there and input number recursively until number value is not valid. Calculate and display the factorial of that number. Exercise 10: Write a c program to read time in hours, minutes, seconds, make sure input value should be correct, if input values are wrong read them recursively. Calculate how many seconds in your time. Exercise 11: Write a C program to display the following menu: