Search
 
SCRIPT & CODE EXAMPLE
 

C

C float division

// By default what '/' is doing is a simple euclidian division
// (The remainder is calculated with modulo '%')
//	Casting both numbers to float will get you a nice decimal

float f = (float)a / (float)b
Comment

C program for float division of numbers

#include <stdio.h>

void main() {
    int a;
    float b, c, d;
    a = 750;
    b = a / 350;
    c = 750;
    d = c / 350;
    printf("%.2f %.2f", b, d);
    // output: 2.00 2.14
  
}
Comment

PREVIOUS NEXT
Code Example
C :: execution time of c program 
C :: if statement shorthand c 
C :: Numeri in ordine crescente C 
C :: Using PostgreSQL array to store many-to-many relationship using sqlalchemy 
C :: c data types 
C :: printf fill with 0 
C :: see if two strings are equal in C 
C :: sigaction in c 
C :: Succ de ch 
C :: multiplication of two matrix in c 
C :: print 0 1 2 3 4 in c 
C :: exclamation mark in c 
C :: c number to string 
C :: selection sort in c 
C :: c static variables 
C :: check if string in string c 
C :: read string with space c 
C :: Access denied creating xampp-control.ini 
C :: remove axis numpy array 
C :: c programming how to force stop the programme 
C :: remove string from string c 
C :: c header file example 
C :: c strstr 
C :: c bits 
C :: qtableview get selected row 
C :: pid of a process in c 
C :: binary tree count number of leaves in c 
C :: refresh a chromebook terminal 
C :: array of strings c 
C :: windows make clean 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =