Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

" ; " after loop



Comment



Specifer



Header file



Iterative statement




Function_ given number is square type or not




// AHF C PROGRAM SOLVING

//The problem are solving here using FUNCTION

#include<stdio.h> #include<math.h> #define pf printf //function declaration int fact(int); void main() { int x,res; printf("Enter any number: "); scanf("%d",&x); //function call res=fact(x); if(res==1) printf("\n%d is square type integer number.",x); else printf("\n%d is not square type integer number.",x); return 0; } //function definition int fact(int n) //function header //function body { int a; float b; a=sqrt(n); //checking root value b=sqrt(n); //checking root value if(a==b) //checking equality return 1; //if there is no fraction value the output will true else return 0; //if there is fraction value the output will false }
OUTPUT:


© 2018 - All rights reserved