Everyday-Geeks
Home
Windows
iOS
Android
Linux
Internet
Programming
Thursday, May 30, 2013
C Programming: Input only integer
9:05 AM
Programming
No comments
Result:
//input number only #include
#include
#include
int InputINT(); void main() { int math,physic,english; printf("math: "); math=InputINT(); printf("physic: "); physic=InputINT(); printf("english: "); english=InputINT(); printf("Average = %.2f",(math+physic+english)/3.0); } int InputINT() { int num,i=0; char st[20]=""; char ch; ch=getch(); while(ch!=13) { if(ch>=48&&ch<=57) { printf("%c",ch); st[i]=ch; i=i+1; } if(ch==8&&i>0) { printf("\b"); i=i-1; st[i]='\0'; } ch=getch(); } num=atoi(st); printf("\n"); return(num); }
Email This
BlogThis!
Share to X
Share to Facebook
Share to Pinterest
Newer Post
Older Post
Home
0 comments:
Post a Comment
Subscribe to:
Post Comments (Atom)
Social Profiles
Popular
Tags
Blog Archives
Blog Archive
►
2014
(6)
►
March
(3)
►
February
(3)
▼
2013
(13)
►
August
(1)
►
June
(1)
▼
May
(11)
Python: Convert from Binary to Decimal
Fake iOS version in iPhone, iPad, iPhone using iFi...
Python: Covert from Decimal to Binary
C Programming: Input only integer
C Programming: Copy to clipboard
Fake CPU's name with regedit in Windows 8
Share Internet connection from PC to other devices...
Hack Candy Crush Saga by using Firefox extension
Lock PC temporarily when someone log your computer...
Mac OS X 10.8 Mountain Lion on Vmware Workstation 9
Turn your Desktop to Jarvis + Iron Man by using Ra...
Like us
0 comments:
Post a Comment