C program to find the square of all the number between 1 To N.

 Today we are write a program to find the square of all the number between 1 To N. so before we write a program we need to know about, Square is product  of two same number.

We can find square by multiply the two same number.

For example: If we have to find the square of 2 so we have to 

  • 2*2 =4 and
  • 5*5=25 like that…
I know everybody know this, so now we talk about c program. In this program we use:

  • Loop (in this program we use for loop)
  • Arithmetic operator



So now we are write our program to find the square of all the number between 1 To N.

SOURCE CODE:-


#include<stdio.h>
int main(){
   int i,n;
    printf("enter the number to get square:");
    scanf("%d",&n);
  
    for(i=1;i<=n;i++){
  printf("square of %d is > %d\t\t",i,i*i);
    }
    return 0;
}

OUTPUT:-

enter the number to get square:5
square of 1 is > 1              square of 2 is > 4              square of 3 is > 9
square of 4 is > 16             square of 5 is > 25 

OUTPUT:-

enter the number to get square:25
square of 1 is > 1              square of 2 is > 4              square of 3 is > 9
square of 4 is > 16             square of 5 is > 25             square of 6 is > 36
square of 7 is > 49             square of 8 is > 64             square of 9 is > 81
square of 10 is > 100           square of 11 is > 121           square of 12 is > 144
square of 13 is > 169           square of 14 is > 196           square of 15 is > 225
square of 16 is > 256           square of 17 is > 289           square of 18 is > 324
square of 19 is > 361           square of 20 is > 400           square of 21 is > 441
square of 22 is > 484           square of 23 is > 529           square of 24 is > 576
square of 25 is > 625 

 IF THIS CONTANT HEIP YOU THEN SHARE IT TO HELP OTHERS


0 Comments