Program to find square root of a given number using Functions

# include <stdio.h>
#include<conio.h>
int square ( int n);
main ( )
{
int n, s;
printf (“enter a number”);
scanf (“%d”, &n);
s=square (n);
printf (“\n% d”, s);
getch ( );
}
int square ( int n)
{
int p;
p= n * n;
return (p);
}

Out put:

Enter a number 6

36

Related

Program for calculating Sum of Digits of a given Number

#include<stdio.h> #include<conio.h> main (  ) { int n, s,n,r ; 0; printf (“enter a number”); scanf (“%d”, &n); while (n! = 0) { r = n% 10; s = r + s; n = n/10; prin...

Write A Program for sorting of n numbers (bubble sort)

#include<stdio.h> #include<conio.h> void main ( ) { int x [100],n; i, j, temp; printf (“enter size of the array”); scanf ("%d”, & n); printf (“\n enter elements into an arra...

Write A Program for searching of an element in an array (linear search)

#include<stdio.h> #include<conio.h> void main ( ) { int x [100]; i,n, flag, key ; flag = 0; printf (“enter n value”); scanf ("%d”, & n); printf (“\n Enter elements into an ar...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item