code

  1 #include<stdio.h> 
  2 #include<stdlib.h> 
  3 int main() 
  4 {  
  5 int a = 1; 
  6  int b = 2;  
  7 a = a + b;  
  8 b = a - b;  
  9 a = a - b;  
 10 printf("a=%d\n", a);  
 11 printf("b=%d\n", b);  
 12 system("pause");  
 13 return 0;
 14  } 
 15 
 16 
 17 
 18 2.(1)  
 19 #include<stdio.h>
 20  #include<stdlib.h> 
 21 int main() 
 22 { 
 23  int a = 1; 
 24  int b = 2; 
 25  int c = 0;  
 26 c = a;  
 27 a = b; 
 28  b = c; 
 29  printf("a=%d\n", a);  
 30 printf("b=%d\n", b);  
 31 system("pause");  
 32 return 0;
 33 
 34 2(2). 
 35 #include<stdio.h>
 36  #include<stdlib.h> 
 37  int main()  
 38 { 
 39 int a=1;  
 40  int b=2;   
 41 a=a^b;   
 42 b=b^a;  
 43  a=a^b;   
 44 printf("a=%d\n",a);   
 45 printf("b=%d",b);  
 46 system("pause"); 
 47  return 0;      }
 48 
 49 3.
 50  #include<stdio.h> 
 51 #include<stdlib.h> 
 52 #include<math.h>
 53 
 54 int main()
 55 
 56 {
 57 
 58 int i =0,a[10];
 59 
 60 for(i = 0; i < 10; i++)
 61 
 62 scanf("%d",&a[i]);
 63 
 64 int max = a[0];
 65 
 66 for(i = 0; i < 10; i++)
 67 
 68 if(max < a[i])
 69 
 70 max = a[i];
 71 
 72 printf("%d",max);
 73 
 74  system("pause");  return 0;}
 75 
 76      4 
 77 #include<stdio.h>
 78  #include<stdlib.h> 
 79 int main() {  
 80 int a,b,c,t;  
 81 scanf("%d %d %d",&a,&b,&c);  
 82 if(a<b)  
 83  {  
 84   t=b;    b=a;    a=t;  }    
 85   if(a<c) 
 86  {   
 87  t=a;    a=c;    c=t;  } 
 88  if(c>b) 
 89  {   t=b;   b=c;   c=t;    }  
 90 printf("%d %d %d",a,b,c);
 91 
 92  system("pause"); 
 93  return 0;    
 94  } 5.
 95  #include<stdio.h>
 96  #include<stdlib.h> 
 97 int main() 
 98 {   
 99  int a,b,c;   
100  scanf("%d %d",&a,&b);   
101 
102  while(a%b) 
103 
104  {  c=a%b;      a=b;   b=c;}       
105 
106  printf("%d",b);  
107  system("pause"); 
108   return 0; }    
View Code

 

posted on 2018-09-19 17:32  singleday  阅读(106)  评论(0编辑  收藏  举报