Advertisement
Shailrshah

Function that provides the desired space between two numbers

May 26th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. int space(int n)
  3. {
  4.         int i;
  5.         for(i=0;i<n;i++)
  6.                 printf(" ");
  7.         return 0;
  8. }
  9. int main()
  10. {
  11.         int a,b,x;
  12.         printf("Enter two numbers:-");
  13.         scanf("%d%d",&a,&b);
  14.         printf("Enter the number of spaces: ");
  15.         scanf("%d",&x);
  16.         printf("%d",a);
  17.         space(x);
  18.         printf("%d",b);
  19.         fflush(stdin);
  20.         getchar();
  21.         return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement