Click here to Skip to main content
15,868,005 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace function_of_product
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("x=");
            Console.Write("y=");
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            int tot = multi(x, y);
            Console.WriteLine("tot=" + res);
            Console.ReadKey();
        }
        static int multi(int x, int y);

        int res = x * y;
        Return (res);


    }
}
Posted
Comments
fjdiewornncalwe 31-Jan-13 11:04am    
This is clearly either an interview or exam question.
ẶȠǻ ŶắŚmiŋắ 31-Jan-13 15:34pm    
there any wrong in this statement int res = x * y;
Return (res);

1 solution

You are doing

C#
Console.WriteLine("tot=" + res);


I think the res in the above statement should be tot

before

C#
int res = x * y;


There is a lot wrong with your code,

C#
Console.Write("x=");
Console.Write("y=");
int x = int.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());


should be

C#
Console.Write("x=");
int x = int.Parse(Console.ReadLine());

Console.Write("y=");
int y = int.Parse(Console.ReadLine());
 
Share this answer
 
v2
Comments
Adam R Harris 31-Jan-13 16:20pm    
i wonder what this is supposed to do:
static int multi(int x, int y);
DinoRondelly 31-Jan-13 16:22pm    
static int multi(int x, int y)
{
int res = x * y;
return (res);
}
Adam R Harris 31-Jan-13 16:23pm    
missing a few curlys i take it then.
DinoRondelly 31-Jan-13 16:24pm    
I was just trying to help the guy out didnt know i was setting myself up for all this :)
Adam R Harris 31-Jan-13 16:26pm    
Buddy is either applying for a job and they want him to determine whats wrong with this code OR he is working on something in school and this is one of the problems. What he really should have done is drop it into a new console app and then watch visual studio freak out over all the syntax stuff then tried to run it to work out the logical stuff.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900