Advertisement
Nabil-Ahmed

Untitled

Jul 5th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. // take N as an input and print the first N natural numbers//
  2. #include<stdio.h>
  3. int main()
  4. {
  5.     int n, num;
  6.  
  7.     printf("enter the number :");
  8.  
  9.     scanf("%d",&n);
  10.  
  11.     while(n!=0)
  12.     {
  13.         num=n%10;
  14.         n=n/10;
  15.     }
  16.  
  17.     printf("first digit=%d",num);
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement