• 实验四


    1.

    #include<stdio.h>

    int main()

    {

        int arr[10];

             int i,j,k;

             for(i=0;i<10;i++)

             {

                 scanf("%d ",arr[i]);

             }

             for (i=0;i<9;i++)

             {

                       for(j=0;j<9-i;j++)

                       {

                           if (arr[j]>=arr[j+1])

                                {

                                    k=arr[j];

                                         arr[j]=arr[j+1];

                                         arr[j+1]=k;

                                }

                       }

             }

             for (i=0;i<10;i++)

             {

                       printf("%d ",arr[i]);

             }

        return 0;

    }

                           

    2.

    #include <stdio.h>

    int main()

    {

    int arr[3][3];

    int i,j,sum;

    for (i=0;i<3;i++)

    {

        for (j=0;j<3;j++)

             {

             scanf("%d",arr[i][j]);

             }

    }

    sum=0;

    for (i=0;i<3;i++)

    {

    sum=arr[i][i]+arr[i][2-i]+sum;

    }

    printf("%d ",sum);

    return 0;

    }

    3.

    #include<stdio.h>

    int main()

    {

       char s[10000];

       int i,j,n;

       j=0;

       i=0;

       scanf("%c",&s[i]);

       while (s[i]!=' ')

       {

           if (s[i]==' ')

                {

                j++;

                }

                i++;

           scanf("%c",&s[i]);

       }

       printf("%d ",j+1);

       return 0;

    }

     

    4.

    #include<stdio.h>

    #include<math.h>

    int main()

    {

             int arr[100]={0};

             int i,j,n;

             n=sqrt(100);

             for (i=2;i<=n;i++)

             {

                 for (j=2;j<=100;j++)

                       {

                           if (j%i==0)

                                         arr[j-1]=1;

                       }

             }

        arr[1]=0;

             arr[0]=1;

             arr[2]=0;

             arr[4]=0;

             arr[6]=0;

             for (i=0;i<100;i++)

             {

             if (arr[i]==0)

                       printf("%d ",i+1);

             }

       return 0;

    }

  • 相关阅读:
    语言混编总结二
    可执行文件与符号(表)
    iOS错误报告中关于崩溃地址的分析
    Find the build UUID in a Crash Report
    Symbolicating Crash Reports With atos
    iOS crash log 解析 symbol address = stack address
    Address space layout randomization
    ASLR(Address space layout randomization)地址空间布局随机化
    缓冲区溢出详解
    如何快速查看将C反汇编的代码
  • 原文地址:https://www.cnblogs.com/p201821440037/p/10894181.html
Copyright © 2020-2023  润新知