current position:Home>C voice writing will not come. Let's have a look

C voice writing will not come. Let's have a look

2022-02-02 19:57:59 CSDN Q & A

1. The values of the elements of an array are :12, 7,13,-6,-14,0,-1,-4, 9, -14, To write
Program , Features include :
Define an array and initialize ;
Traverse the array and print out each element ;
Will be less than or equal to... In the array 0 Print out the elements ;
2. Write a sub function , Can realize from 1 Concatenation to a specified positive integer , At the same time, we call this in the main function.
Subfunctions , respectively 1 To 10 The tandem of ,1 To 20 The tandem of , Output the results at the same time .




Refer to the answer 1:
#include<stdio.h>float s(int n){    float sum = 0;    for(int i=1; i<=n; i++)    {        sum *= i;    }    return sum;}int main(){    int a[] = {
   
   
   
   12,7,13,-6,-14,0,-1,-4,9,-14};    for(int i=0; i<sizeof(a)/sizeof(int); i++)    {        printf("%d", a[i]);    }    for(int i=0; i<sizeof(a)/sizeof(int); i++)    {        if(a[i] <= 0)            printf("%d", a[i]);    }        int n;    scanf("%d", n);    float sum = s(n);    printf("%f", sum);    return 0;}



Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021957542495.html

Random recommended