C Program to find perfect square numbers between 1 to n


In this program, You will learn how to find perfect square numbers between 1 to n in c.


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

int main() {
   //Statement
}

Example: How to find the average of 5 subjects in C

#include<stdio.h>
#include<math.h>
int main() {

  int n, i, root;

  printf("Enter a number:");
  scanf("%d", & n);

  for (i = 1; i <= n; i++) {

    root = sqrt(i);
    root = root * root;

    if (i == root) {
      printf("\ni = %d", i);
    }
  }

  return 0;
}

Output:

Enter a number:50  
                                                                                                                                       
i = 1
i = 4
i = 9
i = 16
i = 25
i = 36
i = 49