Advertisement
Mahfuz123

Problem 42

May 26th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int n,i,j,a,b,c,d;
  6.  
  7. scanf("%d",&n);
  8.  
  9. if(n<=100){
  10. for(i=1;i<=n;i++){
  11. scanf("%d",&a);
  12.  
  13. if(a<=50){
  14. for(j=a;j>=0;j--){
  15.  
  16. if(j>=2){
  17. printf("2^%d + ",j);
  18. }
  19.  
  20. else if(j==1){
  21.  
  22. printf("%d + ",2*j);
  23. }
  24. else if(j==0){
  25. printf("%d",j+1);
  26. }
  27. }
  28. }
  29. printf("\n");
  30. }
  31. }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement