Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- void funckija(int n, int * niza) {
- // *(niza + i) = niza[i]
- int najgolem_element = niza[0];
- for(int i = 0; i < n; i++) {
- if( *(niza + i) > najgolem_element) {
- najgolem_element = *(niza + i);
- }
- }
- for(int i = 0; i < n; i++) {
- if(*(niza + i) % 2 == 1) {
- *(niza + i) = najgolem_element;
- }
- }
- }
- int main(int argc, const char * argv[]) {
- int n;
- scanf("%d", &n);
- int niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%d", &niza[i]);
- }
- funckija(n, niza);
- for(int i = 0; i < n; i++) {
- printf("%d ", niza[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement