Advertisement
rizqiaak12

Untitled

Dec 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h> //nomor 7
  2. #include <conio.h>
  3. void cetak_bilangan_asli(void);
  4. int i,n,jum=0;
  5. main(){
  6.  
  7. printf("Masukan Bilangan ke-n = ");
  8. scanf("%d",&n);
  9. cetak_bilangan_asli();
  10. printf("\nJumlah Semua bilangan asli = %d ",jum);
  11.  
  12. getch();
  13. }
  14.  
  15. void cetak_bilangan_asli(void){
  16. i++;
  17. printf("%d ",i);
  18. jum=jum+i;
  19. if (i<n)
  20. cetak_bilangan_asli();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement