C
Programming and Technical
Programming
For the following C program
#define AREA(x)(3.14*x*x)
main()
{float r1=6.25,r2=2.5,a;
a=AREA(r1);
printf("n Area of the circle is %f", a);
a=AREA(r2);
printf("n Area of the circle is %f", a);
}
What is the output?
Read Solution (Total 4)
-
- output would be
Area of thecircle is 122.656250
Area of the circle is 19.625000 - 11 years agoHelpfull: Yes(5) No(0)
- in line 5 & 7 is missing before n.
- 11 years agoHelpfull: Yes(0) No(0)
- 122.65625
19.625 - 10 years agoHelpfull: Yes(0) No(1)
- n Area of the circle is 122.656250n Area of the circle is 19.625000
- 10 years agoHelpfull: Yes(0) No(1)
C Other Question
What will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line number:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
} //Line number 15//
a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1
What will be the output for the following C program ..??
void main()
{
int i;
for(i=1;i<4,i++)
switch(i)
case 1: printf("%d",i);break;
{
case 2:printf("%d",i);break;
case 3:printf("%d",i);break;
}
switch(i) case 4:printf("%d",i);
}