TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
326.1k
Parallel array
Dec 22 2011 1:31 PM
This program is for question 4. When the area code is 262 program is executing well but program is not working for other area codes. Please correct the error. I attach the question.
using System;
namespace _6e4
{
class Program
{
static void Main(string[] args)
{
int[] code = {262, 414, 608, 715, 815, 920};
double[] rate = {0.07, 0.10, 0.05, 0.16, 0.24, 0.14};
double cost;
Console.Write("Enter the area code ");
string s = Console.ReadLine();
Console.Write("Number of minutes talk ");
string t = Console.ReadLine();
for (int x = 0; x < code.Length; ++x)
{
if(Convert.ToInt32(s)==code[x])
{
cost = rate[x] * Convert.ToDouble(t);
Console.WriteLine("Total cost = {0}", cost.ToString("C"));
x = code.Length;
}
Console.ReadKey();
}
}
}
}
Attachment:
228.zip
Reply
Answers (
31
)
ADD dropdown for different financial year
Looking for developers to help in free and opensource project