int f (int n) { int ans = 0; for (int i = 1; i < n; i++) { if (i < n/2) { ans -= i; } else { ans += i; } } return ans; } what is f(7)
Answers
Answered by
1
Answer:
number is 15
please mark me brianliest
Explanation:
#include<stdio.h>
int f (int n) {
int ans = 0;
for (int i = 1; i < n; i++) {
if (i < n/2) {
ans -= i;
}
else {
ans += i;
}
}
return ans;
}
int main()
{
printf("Numbers are %d",f(7));
return 0;
}
Similar questions