Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how do i write code for this formula in c#.
f2/f1xr

f1 = class or subject
f2 = total credit hour per week
r = classroom
Posted
Updated 19-Mar-14 1:12am
v2
Comments
nandakishoreroyal 19-Mar-14 7:13am    
Explain briefly...
CPallini 19-Mar-14 7:17am    
It doesn't look rocket science. What's the problem?
Tejas Vaishnav 19-Mar-14 7:18am    
what type of value in f2, f1 and r?

if all are double or integer then you can write like this...

double restult = (f2/f1) * r;

1 solution

The chances are that you want to input the values from the user and generate the result.
Unfortunately, we can't see your screen, so we don;t know what environment you are working in. But...assuming you know haw to get three strings called stringF1, stringF2, and stringR then all you have to do is convert them to numbers and complete it:
C#
double f1;
if (!TryParse(stringF1, out f1))
   {
   // Report a problem to your user and stop
   }
double f2;
if (!TryParse(stringF2, out f2))
   {
   // Report a problem to your user and stop
   }
double r;
if (!TryParse(stringR, out r))
   {
   // Report a problem to your user and stop
   }
double result = (f1 / f2) * r;
string stringResult = result.ToString();
Which you can print to your console, or put to a lable, or whatever your envirtonment allows.
 
Share this answer
 
v2

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