int main()
{
int days;
printf("enter days you are late");
scanf("%d",days);
if (days<=5)
printf("5o paisa fine");
if (days<=10&&days>=6)
printf("1rs fine");
if(days>10)
printf("10 rs fine");
if(days=30)
printf("membership cancelled");
return 0;
}

tell me whats wrong in this program? is it right?

Answers were Sorted based on User's Feedback



int main() { int days; printf("enter days you are late"); scanf("%d",days..

Answer / hajera

1. & is missing in scanf and

2. if(days=30) one more equal is missing

instead of if(days == 30)
printf("membership cancelled")

Is This Answer Correct ?    2 Yes 0 No

int main() { int days; printf("enter days you are late"); scanf("%d",days..

Answer / sandeep

Guys '&' is missing in the scanf statement

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

Is multithreading possible in c?

0 Answers  


#include<stdio.h> #include<conio.h> void main() { float a; clrscr(); a=0.5; if(a==0.5) printf("yes"); else printf("no"); getch(); }

9 Answers   TCS,


What is extern keyword in c?

0 Answers  


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

0 Answers  


Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.

2 Answers   Infosys,






write the output of following code .. main() { static int a[]={10,20,30,40,50}; int *ptr=a; static int arr[2][2]={1,2,3,4}; char str[]="ABCD * 4#"; char *s=str+2; int i,j; for(i=0;i<5,i++) printf("%d",*ptr++); for(i=0;i<2;i++) for(j=0;j<2;j++) printf("%d\n",*(*(n+i)+j)); printf("%c\n%c\n%c\n",*(str+2),*s++,*--s); }

1 Answers  


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

0 Answers  


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


Tell me when would you use a pointer to a function?

0 Answers  


program for following output using for loop? 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5

8 Answers   Infosys,


What is the best way of making my program efficient?

0 Answers  


write a program to copy a string without using a string?

2 Answers  


Categories