yogesh


{ City } pune
< Country > india
* Profession * student
User No # 24178
Total Questions Posted # 0
Total Answers Posted # 8

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 51
Users Marked my Answers as Wrong # 34
Questions / { yogesh }
Questions Answers Category Views Company eMail




Answers / { yogesh }

Question { Infosys, 40005 }

how many error occurs in C language ?


Answer

183 types of Errors.

Is This Answer Correct ?    1 Yes 8 No

Question { 16349 }

How do you write a program which produces its own source
code as its output?


Answer

#include
int main(int argc,char *argv[])
{
FILE *fp;
char ch;
fp=fopen(argv[0],"r");
while(!feof(fp))
{
ch=fgetc(fp);
printf("%c",ch);
}
}

Compile the program as cc -o filename filename.c
and run as
./filename

Is This Answer Correct ?    3 Yes 4 No


Question { Wipro, 8152 }

how to return a multiple value from a function?


Answer

#include
#define PI 3.1415
int main()
{
double area,perimeter,radius;
printf("Enter radius of Circle:");
scanf("%lf",$radius);
calculate(&area,&perimeter,radius);
printf("Area of Circle:%lf\nPerimeter of
Circle:%lf",area,perimeter);
}
calculate(double *a,double *p,double r)
{
*a=PI*r*r;
*p=2*PI*r;
}

Is This Answer Correct ?    3 Yes 0 No

Question { TCS, 101728 }

How to reverse a String without using C functions ?


Answer

#include
int main()
{
char str[80],str1[80];
int i,j;
printf("\n Enter String:");
fgets(str,80,stdin);
for(i=strlen(str)-1,j=0;i>=1;i--)
str1[j++]=str[i];
printf("Reversed String is:%s",str1);
}

Is This Answer Correct ?    18 Yes 14 No

Question { 7714 }

how to convert an char array to decimal array


Answer

#include
int main()
{
char str[40],*s;
char ch,ask;
do
{
s=str;
printf("Enter the string:");
fgets(str,40,stdin);
do
{
printf("%d ",*s++);
}while(*s);
printf("\nDo u want to enter another string
(y/n):");
ask=getchar();
if(ask=='n')
break;
}while((ch=getchar())!='n');
printf("\n");
}

Is This Answer Correct ?    1 Yes 0 No

Question { Verifone, 9339 }

write a function for strtok()??


Answer

strtok() function is used for tokanizing the given string.
The output of the following program will be as follows.
How|are|you|I|am|Fine.

#include
int main()
{
char *p;
char str[40]="How are you,I am Fine";
p=strtok(str," ");
printf("%s",p);
do
{
p=strtok('\0',", ");
if(p)
printf("|%s",p);
}while(p);
printf("\n");
}

Is This Answer Correct ?    4 Yes 5 No

Question { 4849 }

design and implement a program that reads floating-points
numbers in a sentinel-controlled loop until the user
terminates the program by entering zero.your program should
determinate and print the smallest,largest and average of
the supplied numbers.


Answer

#include
#define MAX 20
int main()
{
float no,a[MAX],sum=0.0,avg;
int n,i;
float min,max;
printf("\n Enter How Many Numbers:");
scanf("%d",&n);
i=0;
min=0;
max=0;
do
{
printf("\n Enter a number(Enter 0 to
stop):");
scanf("%f",&no);
a[i]=no;
if(no==0)
break;
else
{
if(a[i] min=a[i];
else if(a[i]>max)
max=a[i];
sum=sum+a[i];
}
i++;
}
while(i avg=sum/i;
printf("\n The Smallest Number is:%f",min);
printf("\n The Largest Number is:%f",max);
printf("\n The Average of Entered %d numbers is:%.2f
\n",i,avg);
}

Is This Answer Correct ?    1 Yes 3 No

Question { 5883 }

Is multiple try block is possible in single java
Application......


Answer

yes,multiple try block is possible in java application.

Is This Answer Correct ?    20 Yes 0 No