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 8155327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:38:24+00:00 2026-06-06T16:38:24+00:00

I am attempting to have the for statement iterate and increase the number i

  • 0

I am attempting to have the for statement iterate and increase the number i from 0 to 100.

This will be displayed on the screen.

My issue is not quite understanding what I want to return in the method (not Main) but if I need to return anything.

I don’t want to return a int. I don’t think I have a string to return as I want it to perform a function not return a value. I think I am messing up method types.

I want the method to simply go through the if statements and if a parameter matches then display the result on screen, if not move on to bottom and start again from for statement.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace Project5
    {
      class Program
      {
        int i = 0;


        static void Main(int i)
        {
            do
            {
                for (i = 0; i < 101; i++)
                {
                    Words(); 
                }
            } while (i < 101);

            Console.ReadLine();
        }

        static string Words (int i) //<---Here I think I am using the incorrect method type
        {//Which then screws up the method when it is called above. I have been going                
        //through method types but dont see anything that when called just perform a         
        //function and displays results.

            string f = "Word1";
            string b = "Word2";

            if (i == 3)
            {
                Console.Write(f);

                if (i == 5)
                {
                    Console.Write(b);

                    if (0 == (i % 3))
                    {
                        Console.Write(f);

                        if (0 == i % 5)
                        {
                            Console.Write(b);
                        }
                        else
                        {
                            Console.WriteLine(i);  
                        }
                    }

                }
            }

        }
    }
}
  • 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-06T16:38:25+00:00Added an answer on June 6, 2026 at 4:38 pm

    Change

    static string
    

    to

    static void
    

    then it doesn’t have to return anything

    Also you should probably remove the do loop as it is redundant, the for loop should be doing what you want (I think).

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

Sidebar

Related Questions

I am attempting to have mechanize select a form from a page, but the
Hi I have been working on this code today after attempting some of the
I have an issue with returning an iterator from an STL map using an
I currently have the following SQL statement: SELECT s.first_name, s.last_name, tgs.group_identifier FROM staff s
I'm attempting to use a prepared statement to select a value from an SQL
I have an sql statement as below attempting to retrieve the most recent entries
have an issue with a fairly basic query I'm attempting to write. select count
I have an xml feed, which i'm attempting to extract two values from. I'll
I have been attempting to have a object that I can use across multiple
Basically I am attempting to have an AI agent navigate a world based on

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.