# Some mathematical functions

Source: Internet
Author: User

Fmod

`#include <stdio.h>#include<math.h>int main(int argc, char *argv[]){    float a,b,c;    while (scanf("%f %f",&a,&b))    {        c=fmod(a,b);        printf("%f\n",c);    }    return 0;}`
View code

# Include <stdio. h>
# Include <math. h>
Int main (INT argc, char * argv [])
{
Float a, B, c;
While (scanf ("% F", & A, & B ))
{
C = fmod (A, B );
Printf ("% F \ n", C );
}
Return 0;
}

Floor rounded down

`#include <stdio.h>#include<math.h>int main(int argc, char *argv[]){    float a,b,c;    while (scanf("%f",&a))    {        c=floor(a);        printf("%f\n",c);    }    return 0;}`
View code

# Include <stdio. h>
# Include <math. h>
Int main (INT argc, char * argv [])
{
Float a, B, c;
While (scanf ("% F", & ))
{
C = floor ();
Printf ("% F \ n", C );
}
Return 0;
}

Ceil rounded up

`#include <stdio.h>#include<math.h>int main(int argc, char *argv[]){    float a,b,c;    while (scanf("%f",&a))    {        c=ceil(a);        printf("%f\n",c);    }    return 0;}`
View code

# Include <stdio. h>
# Include <math. h>
Int main (INT argc, char * argv [])
{
Float a, B, c;
While (scanf ("% F", & ))
{
C = Ceil ();
Printf ("% F \ n", C );
}
Return 0;
}

Sin sine function

`#include <stdio.h>#include<math.h>#define PI 3.1415926int main(int argc, char *argv[]){    float a,c;    while (scanf("%f",&a))    {        c=sin(a/180*PI);        printf("%f\n",c);    }    return 0;}`
View code

# Include <stdio. h>
# Include <math. h>
# Define PI 3.1415926
Int main (INT argc, char * argv [])
{
Float a, c;
While (scanf ("% F", & ))
{
C = sin (A/180 * PI );
Printf ("% F \ n", C );
}
Return 0;
}

Rounding

`#include <stdio.h>#include<math.h>int main(int argc, char *argv[]){    float a,b,c;    while (scanf("%f",&a))    {        c=floor(a+0.5);        printf("%f\n",c);    }    return 0;}`
View code

# Include <stdio. h>
# Include <math. h>
Int main (INT argc, char * argv [])
{
Float a, B, c;
While (scanf ("% F", & ))
{
C = floor (a + 0.5 );
Printf ("% F \ n", C );
}
Return 0;
}

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.