Easy Sequence

Dev Skill archived problems can be discussed here.

Easy Sequence

by arabin » Sun Nov 13, 2016 11:57 am

here is the code for it but shows wrong answer. can anyone help me out why?

Code: Select all
#include <stdio.h>

int main() {
    int test;
    if (test>0&&test<=20) {
        int answer[test];
        for (int i = 0; i<test; i++) {
            int n;
            if (n>=1&&n<=44) {
                answer[i] = (1+(n-1)*2);
        for (int i = 0; i<test; i++) {
            printf("%d\n", answer[i]);
    return 0;

Posts: 28
Joined: Sat Aug 06, 2016 11:02 pm

Re: Easy Sequence

by devskill » Mon Nov 14, 2016 9:52 pm

This is a very easy problem. From your code it doesn't seem like you figured out the right formula. May be you have to correct the solution first.
User avatar
Site Admin
Posts: 118
Joined: Tue Feb 02, 2016 10:24 pm

Who is online
Users browsing this forum: No registered users and 1 guest