Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

C program to evaluate an square expression and their sum

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program to write a program using a single subscribed variable to evaluate the square expressions given in the image below, and the values of x1, x2, … are read from the terminal in C Programming with practical program code and step-by-step full complete explanation.

C Program to evaluate a square expression.

 
#include<stdio.h>
#include<conio.h>

void main()
{
    int i;
    float x[10],value,total;

    printf("ENTER 10 REAL NUMBERS");

    for(i=0;i<10;i++)
    {
        scanf("%f",&value);
        x[i]=value;
    }

    total=0.0;

    for(i=0;i<10;i++)
        total=total+x[i]*x[i];
    printf("n");

    for(i=0;i<10;i++)
        printf("x[%2d]=%5.2fn",i+1,x[i]);
    printf("total=%.2f",total);
}

Output

 
ENTER 10 REAL NUMBERS
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10
X[1]=1.10
X[2]=2.20
X[3]=3.30
X[4]=4.40
X[5]=5.50
X[6]=6.60
X[7]=7.70
X[8]=8.80
X[9]=9.90
X[10]=10.10

Total=446.86
c coding problems solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes