Single Choice Not Set

QWhat is the output of this C code?

#include<stdio.h>
 int main()
{
	int i = -5;
	int k = i %4;
	printf("%dn", k);
}

ID: #1153 Operators and Enums in C Language 1,709 views
Question Info
#1153Q ID
Not SetDifficulty
Operators and Enums in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A None
  • B Compile time error
  • C -1
  • D 1
Correct Answer

Explanation

Option C is correct answer. % is a remainder after integer division. The % operator is sometimes referred to as the modulus operator. Suppose that a and b are integer variables whose values are 10 and 3. then result will be (a % b) = 1

Share This Question

Challenge a friend or share with your study group.