Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Linuxmania Linuxmania is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 392
Rep Power: 14
Linuxmania mempunyai hidup yang Normal
Default [ASK ] ttg C: scan bilangan tanpa array?

gini gan? mksd ane jadi ada suatu bilangan terdiri dari 4 digit tahun angkatan, 2 digit kode program studi, dan 3 digit nomor urut. Nomor urut ini adalah nomor urut gabungan semua program studi. Contoh NIM: 200701001



na gmna biar dia scan na bisa ke tampung 3 variabel



jadi tahun=2007,kode=01,no urut=001



masalanya ga boleh pake array



ane pke compiler dev c++



jadi ane dah coba bgini

#include

int main(){

int tahun,kode,urut,k_baru;

scanf("%4d%2d%3d",&tahun,&kode,&urut);

//dengan masukan 200701001

printf("%d %d %d",tahun,kode,urut);

//hasil na 2007 1 1

fflush(stdin); getchar();

return 0;

}



gimna biar hasilnya spt ini gan?tahun=2007,kode=01,no urut=001



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 08:25 PM.


no new posts