Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- int n,i,j,a,b,c,d;
- scanf("%d",&n);
- if(n<=100){
- for(i=1;i<=n;i++){
- scanf("%d",&a);
- if(a<=50){
- for(j=a;j>=0;j--){
- d = pow(2,j);
- if(j>=2){
- printf("2^%d + ",j);
- }
- else if(j==1){
- printf("%d + ",d);
- }
- else if(j==0){
- printf("%d\n",d);
- }
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement