Starting from:
$35

$29

Lab07 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.

Arrays in C - special data structure which is used for list of values, manipulation of memory space.

Tasks:
    1. C program to draw a perpendicular triangle with *.

Ex:

*

**

***

****

*****

    2. C program to draw pyramid with *.
Ex – height 4:

*

***

*****

*******

Hint: According to bottom line, find the number of blank characters at the first line(how many blank is at right side and how many blank is at left side?). If height of pyramid is 4, then bottom line has got 7 asterix ((4-1)*2+1). First line has got 6 blank (4-1 left side and 4-1 right side) characters and one Asterix (at the middle.

    3. C program to print all the composite numbers from 2 to a certain number entered by user.

Enter a number:15
4 is composite

6 is composite

8 is composite

9 is composite
10 is composite

12 is composite

14 is composite
15 is composite

Hint: A composite number (bileşik sayı) is a positive integer that can be formed by multiplying two smaller positive integers.

Good Luck

More products