Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:47:49+00:00 2026-06-08T10:47:49+00:00

The program should take in a parameter N and print out N + 1

  • 0

The program should take in a parameter N and print out N + 1 lines.
I have to output something like this.

This is the output which I must get at N = 5

A //Increment by 0

AB //Increment by 1

ACE //Increment by 2

ADGJ //Increment by 3

AEIMQ //Increment by 4

The algorithm uses N as the number of characters to skip in between each add. So at N=3, it’s A skip 3 to D, skip 3 to G, skip three to J.

And when the program runs out of upper case characters(i.e. When N is too big), it should start with lower case characters and if it runs out of lower case then it should again start with upper case and so on.
I am a novice to programming. And I dont really know where to start. I’ve been working around the loops for a while and still have no clue what-so-ever.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:47:50+00:00Added an answer on June 8, 2026 at 10:47 am

    Here’s another approach using a Char[], modulo, StringBuilder and a for-loop which increments by n for efficiency:

    readonly static Char[] letters = 
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".ToCharArray();
    
    static String appendChars(int n)
    {
        int length = n + 1;
        StringBuilder sBuilder = new StringBuilder("A", length);
    
        for (int i = n; sBuilder.Length < length; i += n)
        {
            Char nextChar = letters[i % letters.Length];
            sBuilder.Append(nextChar);
        }
    
        return sBuilder.ToString();
    }
    

    test your sample data:

    int n = 5;
    IEnumerable<String> allWords = Enumerable.Range(0, n).Select(i => appendChars(i));
    Console.Write(string.Join(Environment.NewLine, allWords));
    

    outputs:

    A
    AB 
    ACE 
    ADGJ 
    AEIMQ
    

    Here’s the demo: http://ideone.com/0sspY

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This program should take 5 NSString's in input and print them. I put them
I have this program that should execute a piece of code base on the
I have a server program which should run full time a day. If I
I am wondering what it would take to make something like this work: using
I have a method that has 2 output parameters. The method should take an
my program should print a message on the screen if the formula that the
This program should calculate the value of 2^1+2^2 + ... + 2^10: #include <stdio.h>
Im writing a program that should read input via stdin, so I have the
I have a 3rd-party installer program that I would like for my users to
I'll take a real example I have to implement in a program I'm coding:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.