Write code in C language to add 10 number using array structure?

We will use the following AI tools to complete this task.

Write code in C to add 10 numbers using an array.

The following AI tools will provide complete code in separate comments.

These days, any person can write good content by using an AI tool.

1. Cloud from Aptrnoics
2. ChatGPT from OpenAI
3. Gemini from Google

If you are going to get a degree in Computer Science, good luck with your degree.

3 thoughts on “Write code in C language to add 10 number using array structure?

  1. [OpenAI ChatGPT Generated the following code]

    #include

    int main() {
    int numbers[10];
    int sum = 0;
    int i;

    // Input 10 numbers
    printf(“Enter 10 numbers:\n”);
    for (i = 0; i < 10; i++) { printf("Number %d: ", i + 1); scanf("%d", &numbers[i]); } // Calculate the sum for (i = 0; i < 10; i++) { sum += numbers[i]; } // Display the result printf("\nThe sum of the 10 numbers is: %d\n", sum); return 0; }

  2. [Apptronics Claud Generated the following code]

    #include

    int main() {
    int numbers[10];
    int sum = 0;

    printf(“Enter 10 numbers:\n”);
    for (int i = 0; i < 10; i++) { printf("Number %d: ", i + 1); scanf("%d", &numbers[i]); } for (int i = 0; i < 10; i++) { sum += numbers[i]; } printf("\nNumbers entered: "); for (int i = 0; i < 10; i++) { printf("%d", numbers[i]); if (i < 9) printf(", "); } printf("\nSum of 10 numbers = %d\n", sum); return 0; }

  3. [Google Gemini Generated the following code]

    #include

    int main() {
    int numbers[10];
    int sum = 0;

    // Asking the user for 10 numbers
    printf(“Enter 10 integers:\n”);
    for(int i = 0; i < 10; i++) { printf("Element %d: ", i + 1); scanf("%d", &numbers[i]); } // Calculating the sum for(int i = 0; i < 10; i++) { sum += numbers[i]; } // Displaying the result printf("\nThe sum of the 10 numbers is: %d\n", sum); return 0; }

Leave a Reply