-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest11.c
More file actions
58 lines (53 loc) · 758 Bytes
/
Copy pathtest11.c
File metadata and controls
58 lines (53 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<stdio.h>
int sum(int);
int rev(int);
int digit(int);
int out(int);
void main(){
int n,a[10],i,f;
printf("How many element :: ");
scanf("%d",&n);
printf("arraay elements :: ");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++){
f = out(a[i]);
printf("%d ",f);
}
/*for(i=0;i<n;i++){
printf("%d",a[i]);
}*/
}
int out(int y){
int b;
b = rev(y) + sum(y);
return b;
}
int digit(int k){
int x =1;
while(k != 0){
x =x*10;
k = k/10;
}
return x;
}
int sum(int s){
int j,c =0,k=s;
while(s !=0){
j = s%10;
s = s/10;
c = c+j;
}
int p = c*digit(k);
printf("\n:::: %d\n",p);
return p;
}
int rev(int r){
int k,reverse = 0;
while(r != 0){
k = k%10;
r = r/10;
reverse = reverse*10 + k;
}
return (reverse);
}