edited by
446 views
1 votes
1 votes
What is the output of the following program?

void main()

{

printf("%d",5%2);

printf("%d",-5%2);

printf("%d",5%-2);

printf("%d",-5%-2);

printf("%d",2%5);
}

A) 1,-1 -1 1 0

B)1 -1 1 -1 0

c)1 -1 -1 -1 0

d)1 -1 -1 1 2
edited by

Please log in or register to answer this question.

Related questions

7 votes
7 votes
3 answers
1
Parshu gate asked Nov 20, 2017
784 views
What is the output of the following program?#include<stdio.h int main() { int array[]={10, 20, 30, 40}; printf(“%d”, -2[array]); return 0; }$-60$$-30$$60$Garbage valu...
2 votes
2 votes
1 answer
2
Akshay Nair asked Jan 29, 2018
586 views
Why printf("%d",5%-2); is 1, not -1.
0 votes
0 votes
0 answers
3
srestha asked Mar 7, 2018
612 views
#include<stdio.h int fun1(int x) { x=14; } int fun2(int x) { x=20; } int main() { int(*p)(),m,n; scanf("%d",&m); if(m) p=fun1; else p=fun2; n=(*p)(); printf("%d",n); retu...
0 votes
0 votes
0 answers
4
srestha asked Mar 6, 2018
407 views
#include<stdio.h int main() { char a[]={'A','B','C','D'}; char *p=&a[0]; *p++; printf("%c%c",*++p, *p); }What will be the output?1)C B2)B B3)B A4)C A