473,508 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can anyone please tell me what is wrong with this programme i wrote?

2 New Member
i just started learning C, but after i finished writing this programme, it wouldn't respond to the number that i had entered. can anyone please tell me what is going on? thx!
Attached Images
File Type: jpg Screen Shot 2015-09-25 at 2.49.46 AM.jpg (33.4 KB, 195 views)
Sep 24 '15 #1
4 1537
Clearner321
22 New Member
It works for me. What exactly is the problem you are facing. Better initialize all the local variables i, num1, num2 to 0.
Sep 25 '15 #2
ungetuem
2 New Member
I've been unable to enter any values once i started running the program, it happened to some of my other programs too.
Sep 26 '15 #3
tjnapster555
1 New Member
you need to put your case in parenthesis
case 1:
{
num1=....
num2=.....
printf.....
}

break;
also try to initialize all int to zero
like this
i=num1=num2=0;
Oct 12 '15 #4
donbock
2,426 Recognized Expert Top Contributor
  1. Catch and print the return value from scanf (at least for debugging purposes).
  2. Terminate your puts strings with newline ('\n'). This is helpful when stdio uses buffered I/O.
  3. Notice that if the number is even you fall out of main rather than loop back to enter a new value.
Putting braces around the cases won't change anything.
Oct 14 '15 #5

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

Similar topics

5
2738
by: Scott D | last post by:
I am trying to check and see if a field is posted or not, if not posted then assign $location which is a session variable to $location_other. If it is posted then just assign it to...
8
1830
by: Brian Basquille | last post by:
Hello all, Bit of a change of pace now. As opposed to the typical questions regarding my Air Hockey game, am also working on a Photo Album which uses an Access Database to store information...
29
2242
by: Roy Gourgi | last post by:
Hi, I am new to C#. I have the same time scheduling program written in C++ and it is 5 times faster than my version in C#. Why is it so slow as I thought that C# was only a little slower than...
0
1206
by: Mike | last post by:
Hi All, I am using a COM object and so I have to use a form for it to work. The problem is I need to run it as a service as well. When I run it in a test scenario everything works fine and...
13
1579
by: nigel.t | last post by:
Using linux <?php exec("/bin/tar -cvzf myfile.tgz /home/",$arrayout,$returnval); ?> or perhaps try it on your system and tell me if it does/doesnt and what your linux is? I've also tried
4
1182
by: =?ISO-8859-1?Q?Jo=E3o_Gomes?= | last post by:
Hi, i need to code in c something like this, www.searchbay.org?idapp=93896 can any one pointing me some tricks.. tks for your help.
9
1200
by: bill | last post by:
Dim Con = New OleDb.OleDbConnection("provider=microsoft.jet.oledb.4.0;" & "data source=c:\_Archive\Documentation - Projects\Hardware Tracking - 2008\IT_Assets.mdb") Dim dataAdapter As...
1
1960
by: maheshgupta0248 | last post by:
Hi everyone.. Im newbie in the driver development.. till now i have developed some drivers in Linux. Now I have to change to Windows.. can anyone tell me what are the real differences between driver...
5
1550
by: zewl | last post by:
The following series summation is an approximation for computing the natural logarithm of a floatingpoint value x: logx=–/2]+/3]–/4]+….+(-1)n+1(x-1)^n/n Where 2 >= x > 0 and n is a positive...
0
7124
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...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7046
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...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
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...
0
4707
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
418
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...

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.