Solved

Decimal problem?

Posted on 2006-11-06
11
1,317 Views
Last Modified: 2012-08-13
The following assignment generates a compilation error:

decimal accountBalance = 1550.30;

This code generates the error. "Literal of type double cannot be implicitly converted to type 'decimal';...". To avoid this error, which suffix would you append to the literal value?
0
Comment
Question by:mathieu_cupryk
  • 4
  • 4
  • 3
11 Comments
 
LVL 22

Expert Comment

by:_TAD_
ID: 17885027


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17885028


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17885029


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 15

Accepted Solution

by:
ozymandias earned 250 total points
ID: 17885051
decimal accountBalance = 1550.30M;
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 17885059
I think you need uppercase M.
TAD...you are posting everything 3 times dude.
0
 

Author Comment

by:mathieu_cupryk
ID: 17885088
It should be big M
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 17885104
Is this a quiz ?
0
 

Author Comment

by:mathieu_cupryk
ID: 17885114
No I am helping a friend with some practice questions.



0
 

Author Comment

by:mathieu_cupryk
ID: 17885121
It is to help us improve.
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 17885279

Nope, it doesn't matter.

m and M work equally well.


...and I can't help the triple post.  sometimes it posts multiple times and sometimes it does not.  I think it may be the proxy server I'm going through.
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 17885294
> m and M work equally well
Wow. I did not know that. Never tried it. I am a bit surprised actually.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Angular JS Route 3 68
Not showing JavaScript in the list 5 52
Keyboard 2 33
What namespace do I need to import? 2 25
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question