Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,130 members, 7,818,388 topics. Date: Sunday, 05 May 2024 at 02:10 PM

C Programming Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / C Programming Help (1462 Views)

C Programming Help / [Programming Help] Html Experts Urgently Needed (2) (3) (4)

(1) (Reply) (Go Down)

C Programming Help by cruworld(m): 10:07am On Dec 10, 2009
Am new to C Programming kindly help with this.

#include <stdio.h>

int main(void)
{
int a;
int b;
scanf("%d", &a);
scanf("%d", &b);
printf(" %d + %d=%d",a,b,a+b);
getchar();
return 0;
}

i want to add the value for a and b together but after i input the integer instead of displayng the result it close the prompt, what might be wrong please help.
Re: C Programming Help by Cockyzy(m): 10:58am On Dec 10, 2009
Guy,how far.i used lcc-win32 compiler, I have run your source code,it is error-free and gave output.it could be compiler error, try use fflush(stdin) after each scanf().hope it work in ur compiler.Let chat up.my phone number is 08067438374.
Re: C Programming Help by cruworld(m): 11:10am On Dec 10, 2009
thanks bro i got it, do you reside in Abuja? what is the function of fflush(stdin)
Re: C Programming Help by Cockyzy(m): 12:06am On Dec 11, 2009
Guy,nothing do you,you correct kampe.i live in benin.fflush is to clear the buffer so as to avoid misappropriation of data.the parameter(stdin) passed into the fflush function is to clear the stdin(keyboard)file before subsequent read.am a NID Student in NIIT.do you know software website where i can download free C# compiler.hala back
Re: C Programming Help by cruworld(m): 9:30am On Dec 11, 2009
check microsoft msdn site, i download the one am using from there.
Re: C Programming Help by holusormi(m): 3:17pm On Dec 20, 2009
Ive seen where ur mistake lies,gimmie a few minutes i will get u d correct source code.but 4 now i wan go pound yam 4 mumsi see ya.
Re: C Programming Help by holusormi(m): 4:31pm On Dec 20, 2009
Ok cruworld i've attached the source code 4 u in d attachment below.hope it works 4 u.hapi coding. But ehm remenber to change the extension name of the attachment to '.txt' ooo

Re: C Programming Help by solomnakj: 10:36pm On Dec 27, 2009
the fflush(stdin) is a good idea  bt u cud also try this
after the #include<stdio.h>
add #include<iostream> or #include<iostream.h> if ur usin turbo
then at the very end of ur prog i.e after the getchar() line
add the code system("pause"wink;
this shld also wrk out prfctly. i use visual stdio 2008.
Re: C Programming Help by Foxflames: 12:23am On Dec 29, 2009
I think you should remove the getchar() function.

u don need the getchar() here
Re: C Programming Help by Dilshanmyt: 8:31am On Dec 29, 2009
I originally designed the first, Introductory course around The C Programming Language by Kernighan and Ritchie, and the notes were designed to complement that text, highlighting important points and explaining subtleties which might be lost on the general reader.
Re: C Programming Help by Borat1: 9:45pm On Jan 05, 2010
solomnakj:

the fflush(stdin) is a good idea  bt u cud also try this
after the #include<stdio.h>
add #include<iostream> or #include<iostream.h> if your usin turbo
then at the very end of your prog i.e after the getchar() line
add the code system("pause"wink;
this shld also wrk out prfctly. i use visual stdio 2008.


Thats just what is missing. . .

system("PAUSE"wink;

although the program is working,
you need the code above to 'pause' the output on the screen so you can see it
Get yourself a better compiler (code::blocks)

1 Like

Re: C Programming Help by cruworld(m): 8:45am On Jan 07, 2010
thanks Guys, am using Dev C++ compiler
Re: C Programming Help by Garip: 4:56pm On Jan 07, 2010
C is a general-purpose computer programming language for use with the Unix operating system.C is one of the most popular programming languages.It is widely used on many different software platforms and there are few computer architectures for which a C compiler does not exist.
Re: C Programming Help by KHYLE(m): 8:13pm On Mar 12, 2013
Cockyzy: Guy,nothing do you,you correct kampe.i live in benin.fflush is to clear the buffer so as to avoid misappropriation of data.the parameter(stdin) passed into the fflush function is to clear the stdin(keyboard)file before subsequent read.am a NID Student in NIIT.do you know software website where i can download free C# compiler.hala back
please which university acept NID certificate in nigeria

(1) (Reply)

Ideas For Phone/PC Applications / Can I Create A Php Site With Mobile Phone Please Help / Android Programming With Google Cloud Chat - Expert

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.