Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int n;
- printf("Enter the number of terms:\n");
- scanf("%d", &n);
- printf("Printing the %d terms\n", n);
- for(int i = 1; i <=n; i++) {
- if(i%2 != 0) {
- printf("%d", i);
- if(i < n) {
- printf("%c", ',');
- }
- }else {
- printf("%d", i * -1);
- if(i < n) {
- printf("%c", ',');
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment