GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 410 of 436    Print  
Given colors, subtract the fade value and print
What is wrong with the following C# code? It should take the given colors and subtract the given fadeValue and then print out the new faded values. Please copy and paste the code into your response and fix it so that it works correctly. using System;

namespace PCD
{
class MainClass
{
static void Main(string[] args)
{
int red=110;
int green=220;
int blue=230;

getFadedColor(red, green, blue, 10);
getFadedColor(red, green, blue, 20);

Console.WriteLine("red: " + red);
Console.WriteLine("green: " + green);
Console.WriteLine("blue: " + blue);
}

static void getFadedColor(int red, int green, int blue, int fadeValue)
{
red -= fadeValue;
green -= fadeValue;
blue -= fadeValue;
}
}
}



  
Total Answers and Comments: 1 Last Update: March 07, 2008     Asked by: musclebai 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 07, 2008 05:59:45   #1  
kunalkamboj Member Since: March 2008   Contribution: 1    

RE: Given colors, subtract the fade value and print
namespace PCD
{
class MainClass
{
static void Main(string[] args)
{
int red 110;
int green 220;
int blue 230;

getFadedColor(ref red ref green ref blue 10);
getFadedColor(ref red ref green ref blue 20);


Console.WriteLine("red: " + red);
Console.WriteLine("green: " + green);
Console.WriteLine("blue: " + blue);
}

static void getFadedColor(ref int red ref int green ref int blue int fadeValue)
{
red - fadeValue;
green - fadeValue;
blue - fadeValue;
}
}
}

 
Is this answer useful? Yes | No

 Related Questions

The easiest way is to use goto: using System;class BreakExample {public static void Main(String[] args) {for(int i=0; i 
Latest Answer : Yes, there are ways to break out of nested loops.  Although GOTO is allowed in C#, it is normally a bad idea, bad style, and indication of lack of good software development foundation of those who use it (no offense intended).Here are a couple of ...

I have taken a windows application and a button control in it.I want to declare a variable as a sealed and use that variable with in same class as we cannot use in other class. class test {  
Latest Answer : Classes can only be sealed. Methods, Properties, and variables cannot be sealed. ...

What is wrong with the following C# code? It should take the given colors and subtract the given fadeValue and then print out the new faded values. Please copy and paste the code into your response and 
Latest Answer : namespace PCD{ class MainClass { static void Main(string[] args) { int red=110; int green=220; int blue=230;  getFadedColor(ref red, ref  green, ref  blue, 10);  getFadedColor(ref red, ref  green, ref  blue, 20); Console.WriteLine("red: ...

. Below is a set of birds and movements they can perform. Birds:Penguin:• hopping: moves 2 ft• flying: can't flyHawk:• hopping: can't hop• flying: moves 100 ft; won't 
Latest Answer : using System;using System.Collections.Generic;namespace PCD{    public class World    {        public static int temperature = 0; // celcius        public ...

Write a very simple multi threaded program in C#. 1. The program should create two threads that each add data to the same list at the same time. Then after they are both done, print out the entire list. 
Latest Answer : See code below. In practice, the Thread.Sleep() is required - otherwise each thread will complete its work in a single time-slice before the other gets a chance to start. An improvement would be to create a "work item" class for the that would ...


 Sponsored Links

 
Related Articles

Print Servers

Print Servers Print server is a server or advice that is used to connect many printers of a network to it Using the print server any computer on the network can give a print command to the server and the print server will get the job done accordingly Usually a print server is configured on a compute
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

HR Interview - Telephone Interview Etiquette

Telephone Interview Etiquette When you conduct a telephone interview for a job it is important to show the proper etiquette Not only is it important it is critical is you wish to be hired by the company There are a number of things you will want to do and other things should never be done mosgoogle
 

HR Interview - How To Succeed At HR Interviews

How To Succeed At HR Interviews There are a number of things you will need to do in order to make sure you pass the interview process Your appearance is something that you will want to pay close attention to Even if you feel that your appearance shouldn t be a factor in whether or not you re highere
 

HR Interview - Do's and Dont's in a HR Interview

Do s and Dont s in a HR Interview There are a number of things that you will want to avoid during the HR interview process While some of these things are directed at the interviewer the other things are directed at the applicant If interviewers fail to follow the proper procedures throughout the int
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape