Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to prepare Square Root Table

Posted By: Jeremy Morales     Category: C Programming     Views: 5278

Program to prepare Square Root Table

Code for Program to prepare Square Root Table in C Programming

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

void main()
{
    float i,j;
    clrscr();

    gotoxy(25,1);
    printf("Square  Root  Table\n");

    for(j=0;j<=9;j++)
    {
        printf("\n");
        for(i=0 ; i<=1; i= i + 0.1)
        {
            if(j==0)
               printf(" %2.1f | ",i);
            elseif (i==0)
               printf(" %2.1f | ",j);
            elseif (i!=0 && j !=0)
               printf(" %3.1f | ",sqrt(i+j));
        }
    }

    getch();
}

/*
********
OUTPUT
********

Square Root Table

0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 |
1.0 | 1.0 | 1.1 | 1.1 | 1.2 | 1.2 | 1.3 | 1.3 | 1.3 | 1.4 |
2.0 | 1.4 | 1.5 | 1.5 | 1.5 | 1.6 | 1.6 | 1.6 | 1.7 | 1.7 |
3.0 | 1.8 | 1.8 | 1.8 | 1.8 | 1.9 | 1.9 | 1.9 | 1.9 | 2.0 |
4.0 | 2.0 | 2.0 | 2.1 | 2.1 | 2.1 | 2.1 | 2.2 | 2.2 | 2.2 |
5.0 | 2.3 | 2.3 | 2.3 | 2.3 | 2.3 | 2.4 | 2.4 | 2.4 | 2.4 |
6.0 | 2.5 | 2.5 | 2.5 | 2.5 | 2.5 | 2.6 | 2.6 | 2.6 | 2.6 |
7.0 | 2.7 | 2.7 | 2.7 | 2.7 | 2.7 | 2.8 | 2.8 | 2.8 | 2.8 |
8.0 | 2.8 | 2.9 | 2.9 | 2.9 | 2.9 | 2.9 | 2.9 | 3.0 | 3.0 |
9.0 | 3.0 | 3.0 | 3.0 | 3.1 | 3.1 | 3.1 | 3.1 | 3.1 | 3.1 |


*/
  
Share: 


Didn't find what you were looking for? Find more on Program to prepare Square Root Table Or get search suggestion and latest updates.

Jeremy Morales
Jeremy Morales author of Program to prepare Square Root Table is from Phoenix, United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!