473,324 Members | 2,193 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,324 software developers and data experts.

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

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, 194 views)
Sep 24 '15 #1
4 1529
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
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
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 Expert 2GB
  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
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
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
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
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
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
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
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
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
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.