473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can you help me guys with my code?

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. namespace ConsoleApplication1
  3. {
  4.     class Program
  5.     {
  6.  
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.  
  11.                 double a, x, y,b;
  12.                 Console.Write("a=");
  13.             a = double.Parse(Console.ReadLine());
  14.                 Console.Write("b=");
  15.                b= double.Parse( Console.ReadLine());
  16.  
  17.             for (x = a; x < b; x++);
  18.             {
  19.                 if (x <= 3)
  20.                 {
  21.                   y = Math.Log10(Math.Pow(x, 3));
  22.                     Console.WriteLine("y");
  23.                     Console.WriteLine("x");
  24.                 }
  25.  
  26.                 else if (3 < x && x < 4.5)
  27.                 {
  28.                     y = 1 / Math.Abs(Math.Sin(x));
  29.                     Console.WriteLine("y");
  30.                     Console.WriteLine("x");
  31.                 }
  32.                 else if (x <= 4);
  33.                 {
  34.                     y = 1 / Math.Cos(1 / x);
  35.                     Console.WriteLine("y");
  36.                     Console.WriteLine("x");
  37.                 }
  38.             }                      
  39.         }
  40.     }
  41. }
May 30 '22 #1
3 10356
zmbd
5,501 Expert Mod 4TB
Hello mckapusta
Welcome to Bytes.com

We can certainly help you troubleshoot your code; HOWEVER, you need to do a little work first
  1. Tell us what errors you're receiving
  2. Give us an example of the desired output
  3. Tell us what you have done to troubleshoot the code

By, simply stating that your code "doesn't work," along with posting code that appears to have had very little if any troubleshooting performed and expecting someone to help doesn't usually result in much of an answer and may result in your thread being deleted. Instead, please tell us what you were expecting to happen, what actually happened.
May 30 '22 #2
SioSio
272 256MB
Are the semicolons on lines 17 and 32 intentionally written?
May 31 '22 #3
zmbd
5,501 Expert Mod 4TB
Hello SioSio - thank you for your input here!

However, my intention was to have OP do a bit of deep thought otherwise I would have simply pointed out the obvious errors on :
Lines 17/32 - compiler level error - VS2019IDE points this out in the warnings debug
Lines 22/23 - output level error - These, as written, do not produce what one would guess OP is expecting to happen
Lines 29/30 - output level error - ditto
Lines 35/36 - output level error - ditto

We want to encourage our users to post and ask for help (that is what we are here for and enjoy doing - it's our hobby and a kind of pay-it-back for all of the help we received when we were just learning and with something we just can't get our heads around to find the solution ); however, in the long run it's better if some preliminary troubleshooting is done before posting and for OP to list any error messages and steps already taken. In the first case it helps us to narrow down the issues and in the second case it speeds things up because we don't have to "re-invent the wheel"
May 31 '22 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: rigga | last post by:
Hi, I am trying to code a menu for a webpage, the menu is broken up to groups i.e: Home Group1  menuitem1  menuitem2  menuitem3
13
by: Joe Black | last post by:
Just to inform you guys that i have only like 2 weeks that i took my first classes in c++, and my proffesor now is asking me to solve this problem: /// Using a function create a Win32 Console...
3
by: JGBNS via DotNetMonster.com | last post by:
Hi, I am new to this forumand I apologize as i am not a .net programmer but we have a program being developed by a .net programmer. Nowwe have run into an ftp snag and I think it is part ftp and...
2
by: mohit_raghav2003 | last post by:
I have have to check if the dynamically created radiobutton is checked or not.... i am not able to do that at all... i tried to create an event handler as well but it didnot work....so this is what...
3
by: nish | last post by:
I am currently studying java and i came across a question. The following program has several defects (errors) that will generate compile-time errors, logical errors (unintended behaviour) or...
1
by: Flavia | last post by:
PLZ HELP I NEED TO VERIFY DATE(CHECKIF IT IS A TRUEDATE IN THE PAST) AND IF ALL FIELD ARE ENTERED INTO dbEDITBOXES THEN A BUTTON SHOULD SHOW AND LOAD A SINGLE COLOMN (IN TABLE )INTO LISTBOX AND IF...
1
by: raghavshastri | last post by:
You are to write a C++ program to perform a statistical analysis of the blobs in an image. The image will be a grayscale image in PGM format for simplicity. Here is a sample PGM image with 10...
1
by: cheesenips | last post by:
Hey guys, I'm a VB noob sorry.... but I am making a simple friend adder for a social networking site called Teenspot. Right now, when i click a button it will add the username that is on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.