#cant figure it out
35 messages · Page 1 of 1 (latest)
i saw the n which was supposed to be nn
yeah, but your code needs help urgently
there are many things wrong in this code @kind dust
like main function should return 0
#include <stdio.h>
int func() {
int x = 0;
int y = 0;
int z = 0;
int n = 0;
printf("Enter N");
scanf("%d", &n);
if (x < n) {
x++;
y += 2;
}
return x;
}
int main() {
int someInt = func();
printf("%d", someInt);
return 0;
}
this code would be better i think
what's the pourpose of this code?
C Tutorial - C programming is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system. C is the most widely used computer language. It keeps fluctuating at number one scale of popularity
These are good sources to start
thankkku
the user gives the number n and the experstion ) Z = 1/1 + 2/3 + 3/5 + 4/7 + … + N/(2*Ν-1). should be printed at the end
okayyyy thanks alot u are the man
"#include <stdio.h>
int func() {
int x = 1;
int y = 1;
int z = 0;
int n = 0;
printf("Enter N");
scanf("%d", &n);
while (x < n) and ((y+2) < n-1)
z += z + x/z
x += 1;
y += 2;
}
return x;
}
int main() {
int someInt = func();
printf("%d", someInt);
return 0;
}
#include <stdio.h>
int func() {
int x = 1;
int y = 1;
int z = 0;
int n = 0;
printf("Enter N");
scanf("%d", &n);
while ((x < n) && ((y + 2) < n - 1)) {
z += x / z;
x++;
y += 2;
}
return x;
}
int main() {
int someInt = func();
printf("%d", someInt);
return 0;
}
@kind dust
remember close parenthesis
and if you use "+=" there's no need to use x +
int main() is the main function
int means it returns an int number
and is on it where you should place all functions or vars to run code
Oh
Ur code doesn’t run
/tmp/ZNjtYJGcrf.c:16:1: error: expected identifier or '(' before 'return'
16 | return x;
| ^~~~~~
yeah sorry