Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int licz(int a){
  4.     int i;
  5.     int j=0;
  6.     for(i=1;i<a;i++){
  7.             if(a%i==0){
  8.         j++;
  9.         }
  10.         }
  11.         return j;
  12. }
  13. void wypelnij(int a[],int n,int b){
  14.     int j;
  15.     int z;
  16.     for(j=1;j<b;j++){
  17.     if(b%j==0){
  18.         for(z=0;z<n;z++)
  19.         a[z]=j;
  20.     }
  21. }
  22. }
  23.  
  24. int main(){
  25.     int a;
  26.     int b;
  27.     int x;
  28.     int y;
  29.     printf("Podaj pierwsza liczbe \n");
  30.     scanf("%d",&a);
  31.     printf("Podaj druga liczbe \n");
  32.     scanf("%d",&b);
  33.     x=licz(a);
  34.     y=licz(b);
  35.     int aa[x];
  36.     int bb[y];
  37.     wypelnij(aa,x,a);
  38.     wypelnij(bb,y,b);
  39.    
  40.     int o;
  41.         for(o=0;o<x;o++){
  42.        
  43.        
  44.         printf("%d\n",aa[x]);
  45.     }
  46.  
  47.  
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement