473,608 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can you help me guys with my code?

1 New Member
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 10427
zmbd
5,501 Recognized Expert Moderator Expert
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 Contributor
Are the semicolons on lines 17 and 32 intentionally written?
May 31 '22 #3
zmbd
5,501 Recognized Expert Moderator Expert
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
2273
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
1597
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 Application which outputs asterisks (*)on the screen displaying your name like a matrix screen. it has to be in a top down-design style. PLS HELP THIS AMATEUR STUDENT. *_* if you can help me just send the source code... even that i cant do that...
3
2038
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 part .net coding. Heres the issue.. We have an image directory full of photos like 200,000 in it, and if you use an ftp client to ftp to the site and then navagate to that file it will try
2
1203
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 the application should do... create radio buttons dynamically in wizard sheet... user selects a user name.... then returns the name of the user selected i.e. text of the radio button....
3
1622
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 run-time errors (forced termination). Identify and correct 5 such defects by rewriting this program and identifying and correcting the errors. You may identify an error (and the fix for it) using a comment directly above the line that was corrected....
1
1437
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 I SELECT ONE ROW IT MUST BE DELETED IN THE LISTBOX AND ADDED INTO THE TABLE WITH ALL THE OTHER FIELDS IN THAT SPECIFIC TABLE
1
1959
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 columns and 4 rows: P2 # Comment lines # They follow the P2 line. # There could be 0, 1 or more 10 4 255
1
1349
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 listbox and add that person. What i am trying to do is make it automatically go down the list and add all of the usernames. To do that I just need to figure out how to correctly loop this code below Private Sub Button3_Click(ByVal sender As...
0
8010
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8483
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5479
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3967
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4030
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1336
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.