About a C language design question, the master enters 50

Updated on educate 2024-04-12
3 answers
  1. Anonymous users2024-02-07

    main()

    Enter a long integer and output a long integer*

    int i,k,a[100];

    printf("Enter the number of digits:");

    scanf("%d",&a[0]);

    k=a[0];

    printf("Enter each digit of the long integer in turn:");

    for(i=k;i>0;i--)

    scanf("%d",&a[i]);

    printf("The long integer is:");

    for(i=k;i>0;i--)

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

    main()

    Add 2 long integers*

    int i,k,n,a[100],b[100];

    printf("Enter the number of digits of two long integers, separated by commas");

    scanf("%d,%d",&a[0],&b[0]);

    k=a[0];

    n=b[0];

    printf("Enter each of the 2 long integers in turn:");

    for(i=k;i>0;i--)

    scanf("%d",&a[i]);

    for(i=n;i>0;i--)

    scanf("%d",&b[i]);

    if(k>=n){

    for(i=1;i<=n;i++)a[i]+=b[i];

    printf("The long integer after adding is:");

    for(i=k;i>0;i--)printf("%d",a[i]);

    else{for(i=1;i<=k;i++)b[i]+=a[i];

    printf("The long integer after adding is:");

    for(i=n;i>0;i--)printf("%d",b[i]);

    main()

    Convert to 16 decimal output*

    int i,j,k,m,a[100],b[100];

    printf("Enter the number of digits:");

    scanf("%d",&a[0]);

    k=a[0];

    printf("Enter each digit of the long integer in turn:");

    for(i=k;i>0;i--)

    scanf("%d",&a[i]);

    m=a[1];

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

    m+=a[i]*10*(i-1);

    for(i=0;m==0;i++)

    b[i]=m%16;

    m/=16;

    j=i; for(i=0;i=0;i--)if(b[i]>9)printf("%c",b[i]);

    else printf("%d",b[i]);

  2. Anonymous users2024-02-06

    Kunming Institute of Technology??? Hehe.

  3. Anonymous users2024-02-05

    answer:

    1: Right. The reason is that the variables directly defined after the struct are struct variables, and here the data is directly defined, then t[20] is the struct array;

    There are generally three ways to define a struct definition variable:

    First, the direct definition method;

    second, the method of defining the name of the structure;

    third, the typedef definition method;

    2: False. Here, my(x,y) x*y, and when the macro is called, my(2+3,5), then the system will change the x*y of the my macro to x2+3*5, and the correct answer is 17 after the system executes

    If you want the answer to be 25, you can change the way you call the macro to: my((2+3),5) so that the answer is 25

    p+2) represents the starting address of the third column in a, while *(p+2)+3 represents the address of the element in the fourth column of the third row, and finally *(*p+2)+3) represents the value of the element in the fourth column of the third row, which is a[2][3] in the title

    By the way, the array element subscript in c starts at 0 and the last element is n-1.

    Personal understanding, if there is a mistake, please correct, thank you!

Related questions
4 answers2024-04-12

It's not very hard that the tail node next points to null. >>>More

8 answers2024-04-12

Reads characters and counts to'\0'Come to an end!

15 answers2024-04-12

The temperature does not decrease, and the water does not exothermic and solidifies into ice. >>>More

47 answers2024-04-12

Decline. The principle of this thermometer is the thermal expansion and contraction of gas, and under the same conditions, under normal circumstances, the expansion degree of gas is the largest, which is greater than the expansion degree of liquid, so if the temperature rises, the gas will be liquid"Press"goes down, so the liquid column falls. (Definitely yes, 08-09 Yangzhou City eighth grade first semester final research paper penultimate question 2).

6 answers2024-04-12

This question is not difficult, and it is easy to understand the pointers. >>>More