100% function returns int by default
// Online C compiler to run C program online
#include <stdio.h>
squaring(float n) // by default it returns int
{
float ans;
ans=n*n;
printf("square of given number=%f",ans);
return(ans);
}
void main()
{
float i,answer;
printf("\n enter a number whose square is rewuired:");
scanf("%f",&i);
answer=squaring(i);
printf("\n\n square of given number=%f",answer);
}
#include <stdio.h>
squaring(float n) // by default it returns int
{
float ans;
ans=n*n;
printf("square of given number=%f",ans);
return(ans);
}
void main()
{
float i,answer;
printf("\n enter a number whose square is rewuired:");
scanf("%f",&i);
answer=squaring(i);
printf("\n\n square of given number=%f",answer);
}
తెరమీద
enter a number whose square is rewuired:3.5
square of given number=12.250000
square of given number=12.000000
enter a number whose square is rewuired:3.5
square of given number=12.250000
square of given number=12.000000
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.