Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int mainarr[30]={0}, temparr[30]={0};
- int i,j,type,cnt,dir;
- printf("1\n");
- mainarr[0]=1;
- for(i=0; i<9; i++){
- j=0;
- type=0;
- cnt=0;
- dir=0;
- do{
- if(type!=0){
- if(mainarr[j]==type) {
- cnt++;
- } else {
- printf("%d%d", type, cnt);
- temparr[dir]=type;
- temparr[dir+1]=cnt;
- dir+=2;
- type=mainarr[j];
- cnt=1;
- }
- } else {
- type=mainarr[j];
- cnt=1;
- }
- j++;
- }while(mainarr[j-1]!=0);
- printf("\n");
- for(j=j; j>0; j--) mainarr[j]=temparr[j];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement