본문 바로가기

Study Meeting/빡공단 30기

[Day 3] Numeric variables : To represent a number type

In this class, I learned how to express numeric variables and constants (long long, double, float, etc.) in numerical types, and received two numbers as int and double variables to practice quadratic operations.

1. Types of Variables
    - Integer: short, int, long, long long, and so on
       ex) int A = 100
    - Real Number: float, double, double long, and so on
      ex) float A = 1.2

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	
    int A;
    A = 123;
    
    printf("%d", A);
    
    
    double B;
    B = 123.123;
    
    printf("%f", B);
    
    return 0;
}

 

2. Practice for dealing with Quadratic operations

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	
    int A;
    A = 123;
    
    printf("%d", A);
    
    
    double B;
    B = 123.123;
    
    printf("%f", B);
    printf("%f", A+B);
    
    return 0;
}