#include
#include
main ()
{
clrscr()
int a,b,c,d,e,f;
printf("Please enter first value. \n");
scanf("%d", &a);
printf("The first value you entered is %d.\n",a); /*first value entered*/
printf("Please enter second value. \n");
scanf("%d", &b);
printf("The second value you entered is %d.\n",b); /*second value entered*/
c=a+b; /*sum of the two values*/
d=a-b; /*subtraction of the two values*/
e=a*b; /*multiplication of the two values*/
f=a/b; /*division of the two values*/
printf("The sum of the two values is %d, the subtraction of the two values is %d, the multiplication of the two values is %d and the division of the two values is %d.\n",c,d,e,f);
getch()
}
wah! advance ko gne getch! tahniah2.. tp, header ko mane? include jer ade tp stdio.h x der..x bleh run prgrm ni... aku rase #include tu ckp la 1 jer.. pas tu x yah gne clescr() n gethc(). kalo ko gne akn jd error. 1 lg. kalo gne main () ko kene ader return value. kalo x, ko nyer prgrm x leh execute. ko bleh letak kat b4 '}' return 0;. kalo yg len tu, dk cantek dh.. aku just nak share je ape yg aku tau... btw, tahniah awan!!! hehehhe...
ReplyDeleteahahahaa thanks. tak perasan pulak yang include tu. thanks thanks. tapi pasal yang main tu, kena ada return value maksudnya? sebab lecturer aku tak cakap pun, letak main je. tapi kadang-kadang ada void main. apa maksudnya?
ReplyDeleteaku baru perasan, yang include tu, aku dah letak dah sebenarnya tapi blogger tak boleh baca, tu yang kosong je tu. ahaha takpe thanks anyways.
ReplyDeleteoho..aku pernah lihat benda nih..afwa pernah tunjuk kat aku..programming kan..
ReplyDeleteahahaha yeap yeap. aku ada belajar. best oh.
ReplyDeleteoo.. bendalah main tu dye kne return value. aku x reti la xplain kat cni.. kalo nak jmpe kat kelas.. hahaha.. kalo void main (void) or main (void), ko x yah letak return value. ko try la tengok dlm bk c programming.. p jgn lak ko tengpk bk c++ coz x same..
ReplyDelete