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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:01:20+00:00 2026-06-07T18:01:20+00:00

This is my code : the purpose is to add two big numbers ,First

  • 0

This is my code :

the purpose is to add two big numbers ,First input two numbers in 2 array then swaping both and adding them , Console – Based ,

I’m a newbie in C# so please explain keeping in mind my few knowledge of codes

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sum_Two_BIG_Numbes
{
    public class matrix
    {

        public int[] c;

        public void input(int[] a)
        {
            for (int i = 0; i < a.Length; i++)
            {

                a[i] = Convert.ToInt32(Console.ReadLine());

            }
        }
        public void Jamk(int[] a, int[] b, int[] c)
        {

            for (int i = 0; i < a.Length; i++)
            {
                int temp = a[i] + b[i];
                if ((temp < 10) && (c[i] != 1))
                {
                    c[i] = c[i] + temp;
                }
                else
                {
                    c[i] = c[i] + temp % 10;
                    c[i + 1] = c[i + 1] + temp / 10;

                }
            }


        }
        public void swap(int[] a)
        {

            for (int i = 0; i < a.Length; i++)
            {
                a[i] = a[a.Length - i];
            }

        }
    }
    class Program
    {
        public void Main(string[] args)
        {
            int[] a = new matrix();
            //int[] a = new int[30];
            int[] b = new int[30];
            int[] c = new int[30];
            Console.WriteLine("Enter First Number : ");
            matrix.input(a);


            Console.ReadLine();
        }
    }
}

I get this error “An Object Refrence is requiered for the non-static field . . . . ,”

  • 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-07T18:01:22+00:00Added an answer on June 7, 2026 at 6:01 pm
    matrix.input(a);
    

    Where is matrix declared (it isn’t).

    int[] a = new matrix();
    

    Additionally, you cannot assign an instance of matrix to an int[]. There is no implicit conversion from one to the other. Though I can’t say this is a great design, what you wanted was something like this:

    matrix a = new matrix();
    a.c = new int[SomeSize];
    // more code
    a.input(b);  // or something similar...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The purpose of this code is to pull upgrade.zip from a central server, extract
What is the purpose of these java.lang.annotation imports in this code? Why are they
Quick question, What have I done wrong here. The purpose of this code is
I'm using EF 4.1 (Code First). I need to add/update products in a database
When I use this code to download this image (only used for testing purposes),
I have this block of code where when I hover (click for purposes of
I'm looking through some code for learning purposes. I'm working through this portion of
This code below allows me to find the word error in all my files
This code is the core of a much larger script that works great in
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function

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.