Advertisement
Infra_HDC

hello2.c.diff

Apr 16th, 2019
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.52 KB | None | 0 0
  1. --- hello2.c.orig       2019-04-16 23:39:48.917017441 +0300
  2. +++ hello2.c    2019-04-16 23:48:58.039409090 +0300
  3. @@ -1,17 +1,19 @@
  4. -#include
  5. +#include <stdio.h>
  6.  int main(){
  7.  int a, n;
  8.  printf("Enter number: ");
  9.  scanf("%d", &a);
  10.  printf("Enter power: ");
  11. -scanf("%d", n);
  12. -printf("%d", a);
  13. +scanf("%d", &n);
  14. +//printf("%d", a);
  15.  if(n>1){
  16. +int aa=1;
  17.  for(int i=0; i<n; i++)
  18. -a*=a;
  19. -printf("a=%d", a);
  20. +aa*=a;
  21. +a=aa;
  22. +printf("a=%d\n", a);
  23.  }
  24.  else
  25. -printf("a=%d", a);
  26. +printf("a=%d\n", a);
  27.  return 0;
  28.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement