Write a program which prints all factors of number \(N\). The code which prints the factors should be placed inside a function. Print information if \(N\) is a prime number.
Modify the program in such a way that it finds all prime numbers inside a range \(\{1,\ldots,\mathrm{M}\}\). Modify function which prints factors so it only returns information that a number is a prime number or not.
Write a program to see how you can use pointers and arrays:
d
,d
with 10
,p
,p
with the address of the variable d
(p
points to d
),d
and value which is pointed by p
(use operator *
),d
to 20
,d
and value which is pointed by p
,p
,d
and value which is pointed by p
,d
and value of the pointer p
(remember that pointer stores the address, use printf
function, e.g.: printf("%p", &d);
)tab
of integers with two elements (int tab[2];
)333
and 444
,p
address of the array tab
,address of the variable (L-value) | name of the variable | value of the variable (R-value) |
---|---|---|
%p | d | %d |
%p | p | %p |
%p | p[0] | %d |
%p | t | %p |
%p | t[0] | %d |
%p | t[1] | %d |
tab