### 陷进题

#include <stdio.h>int i;   //全局变量 没有初始化 默认是 0int main(){  i--; // -1  if (i > sizeof(i))   //sizeof算出的结果是 4  类型是 无符号整型unsigned int  i被转换成无符号整型 -1变成超级大的数字  {    printf(">");  }  else  {    printf("<");  }  return 0;                  //输出 >}

### //求 Sn = a + aa + aaa + aaaa ...... 的值

#### //例如 2+22+222+222

#define _CRT_SECURE_NO_WARNINGS 1#include <stdio.h>//求 Sn = a + aa + aaa + aaaa  的值//例如 2+22+222+222int main(){  int a = 0;  int n = 0;  printf("依次输入a n");  scanf("%d %d",&a,&n);  int i = 0;  int sum = 0;  int ret = 0;  for (i = 0; i < n; i++)  {    ret = ret * 10 + a;    sum += ret;  }  printf("%d",sum);  return 0;}

### 求自幂数

#include <stdio.h>#include <math.h>                           //求自幂数  (水仙花数的超集)  153 =1^3 + 5^3 + 3^3int main(){  int i = 0;  for (i = 0; i <= 100000; i++)  {    //求位数n    //int n = 0;    int n = 0;    int tmp = i;    while (tmp)    {      n++;      tmp = tmp / 10;          }    //求每个位数的n次方的和    tmp = i;    int sum = 0;    int ret = 0;    while (tmp)    {            sum += pow(tmp % 10, n);      tmp = tmp / 10;    }    //判断    if (sum == i)    {      printf("%d ",i);    }  }  return 0;}