Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute C Online

#include <stdio.h>
/*
лабараторная 
работа 01_01
*/
void main() {
    // начало
    int x = 12;
    int y = 6;
    printf("x + y = %d \n", x + y); // +
    printf("x - y = %d \n", x - y); // -
    printf("x * y = %d \n", x * y); // *
    printf("x %% y = %d \n", x % y); // mod(остаток)
    printf("x / y = %d \n", x / y); // div(целое)
    double a = 11.8,
           b = 4.5;
    printf("a / b = %lf \n", a / b); // /
    printf("x + a = %lf \n", x + a); // +
    char c1 = 10;
    unsigned char c2 = 200;
    printf("c1 + c2 = %d \n", c1 + c2);
    // пример взаимозаменяемых операторов
     int i = 15;
     printf("i = %d \n", i);
     i = i + 1;
     printf("i=i+1 : %d \n", i);
     i++;
     printf("i++ : %d \n", i);
     i += 1;
     printf("i+=1 : %d \n", i);
     i = i - 1;
     printf("i - 1 : %d \n", i);
     i -= 1;
     printf("i-= : %d \n",i);
     i--;
     printf("i-- : %d \n", i);
    // экспоненциальный формат
    double d = -5.438754e3,
           f = 1.3e-7;
    int dInt = (int) d;
    printf("d= %lf \n", d);
    printf("dInt = %d \n", dInt);
    int q = 100,
        w = 34;
    double res1 = q/w;
    double res2 = (double) q/w;
    printf("res1 = %lf \n", res1);
    printf("res2 = %lf \n", res2);
    
    
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.