Job Seven Summary

Source: Internet
Author: User

I. Knowledge POINTS

1. The elements in the array are stored in memory continuously, each element is of the same data type, and array names and subscripts can uniquely determine the array elements.

2.++ operator

i++, ++i, i--, I.

4. Comma-expression
Expression 1, expression 2, expression 3, .... Expression n

5. Character type

The basic representation of data is constants and variables

2. Constants and variables

(1) Constants: Symbolic constant integer constant real constant character type constant

Two. Experimental experience
Practice is a plus in class. Job problems are relatively large. More than the exchange of students

#include <stdio.h>int main (void) {    int i;    long int f[40]={1,1};    for (i=2;i<40;i++)    f[i]=f[i-2]+f[i-1];    for (i=0;i<40;i++)    {        if (i%5==0) printf ("\ n");         printf ("%12ld", F[i]);}    }

  

#include <stdio.h> #include <math.h>int main () {int sign (int x);    int n,sum;    int even (int n);    int j,i;    int prime (int m);    int c,digit,in;    int countdigit (int number,int digit);    int choice=0,num,x;    int is (int number);        do{printf ("* * * * experiment 6:*****\n");        printf ("* * * * Calculates the value of piecewise function: *****\n");            printf ("* * * * Use function to calculate odd and: *****\n");        printf ("* * * * * Use function to calculate the number of *****\n and sum:");        printf ("* * * * * Use function statistics to specify number of numbers: *****\n");        printf ("* * * * Use function output narcissus number: *****\n");        printf ("* * * * * Please select the title: *****\n");        scanf ("%d", &choice);            Switch (choice) {case 1:printf ("clear input x:\n");            scanf ("%d", &x);             printf ("F (%d) =%d\n", X,sign (x));            Break            Case 2:scanf ("%d", &n);            sum=0;             while (n>0) {if (even (n) ==0) sum=sum+n;            scanf ("%d", &n); } printf ("The sum of the odd numbers is%d.\ n ", sum);            Break            Case 3:int C,i,m,n,sum;            scanf ("%d%d", &m,&n);            c=sum=0;                for (i=m;i<=n;i++) if (prime (i)!=0) {C + +;             Sum=sum+i;            } printf ("c=%d,sum=%d\n", c,sum);            Case 4:SCANF ("%d%d", &in,&digit);            C=countdigit (In,digit);            printf ("Number%d of digit%d:%d\n", in,digit,c);            Break            Case 5:int A;            scanf ("%d%d", &m,&c);            printf ("result:\n");            for (a=m;a<=c;a++) if (is (a)!=0) printf ("%d\n", a);            Break        Case 0:break;    }}while (choice!=0); return 0;}     int sign (int x) {if (x>0) return 1;     else if (x==0) return 0; else return-1;}    int even (int n) {int y;    if (n%2==0) Y=1;    else y=0; return y;}    int prime (int m) {int j,i; if (m==1) reTurn 0;    J=sqrt (m);    for (i=2;i<=j;i++) if (m%i==0) return 0; return 1;}    int countdigit (int number,int digit) {int C;    if (number<0) Number=-number;    c=0;           do{if (number%10==digit) C + +;      NUMBER=NUMBER/10;    }while (number!=0);    return c;}    int is (int number) {int digit,sum,temp;    Temp=number;    sum=0;        while (temp!=0) {digit=temp%10;        TEMP=TEMP/10;    Sum=sum+digit*digit*digit;  }return Sum==number;}

  

Job Seven Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.