# Answer to Question #53417 in C for rajashree g.s.

Question #53417
int i=2,j=3; float a,b; k=i/j*j; l=j/i*i; a=i/j*j; b=j/i*i; please sir can you provide me a answer for this question and explain me
#include <stdio.h>

int main()
{
int k,l; // if k and l are integer values
int i=2,j=3;
float a,b;

// i/j*j is the same in C language as (i/j)*j
// j/i*i is the same in C language as (j/i)*i
k=i/j*j; // 2/3 = 0 (because of C language specification, int/int = int), 0*3 = 0 (it's clear)
l=j/i*i; // 3/2 = 1 (because of C language specification, int/int = int), 1*2 = 2 (it's clear)
a=i/j*j; // 2/3 = 0 (because of C language specification, int/int = int), 0*3 = 0 (it's clear), a-floating number => a=0.000000
b=j/i*i; // 3/2 = 1 (because of C language specification, int/int = int), 1*2 = 2 (it's clear), b-floating number => b=2.000000

printf("%d %d %f %f", k, l, a, b); // output is "0 2 0.000000 2.000000"
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Assignment Expert
22.07.15, 20:34

Dear visitor, please use panel for submitting new questions.

rajashree g.s.
17.07.15, 18:54

#include
int main()
{
int x=10,y=20;
if(x==y);
printf("\n %d %d",x,y);
return 0;
}
Actually there is no semicolon after the if statement know sir. In this question there is semicolon after if statement. what will be the output?.please explain the concept behind this sir.