Starting from:

$35

Lab06 Task Solution

Write a C program that performs the task described below. Name your c file as nameSurnameId_tasknumber.c [ex: seydanurAhi171561011_1.c]

Upload your file to your section’s submission page on moodle. There is also a submission page for the ones who are not belong to any section.

1    Task

The Fibonacci sequence is a series whose first two elements are 0 and 1, and each subsequent element equals the sum of the two preceding elements. There is a Fibonacci sequence sample below.

01123581321...

Write a program that waits the user to enter a term number and prints the fibonacci numbers on the screen.

An example of the program:
Please enter how many terms you would like to print: 10
Top 10 terms: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34

2    Task

Write a program that waits the user to enter a number and prints whether the number is prime or not.

3    Task

A perfect number is a number whose sum of all positive divisors except itself is equal to itself.

For example 28 is the perfect number because 28 = 1 + 2 + 4 + 7 + 14.

Write a program that waits for the user to enter a number and prints whether the number is a perfect number or not.





Good Luck

More products