vignesh


{ City } chenna
< Country > india
* Profession * student
User No # 18021
Total Questions Posted # 0
Total Answers Posted # 88

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

Users Marked my Answers as Correct # 974
Users Marked my Answers as Wrong # 508
Answers / { vignesh }

Question { 7289 }

how does printf function work


Answer

1)printf() is a built in library function which is defined
in header file...
2) in printf(); function we can pass
1) entire string within "...." like :
eg: printf("my name is vignesh");

2) string with list of variables like :
eg: printf("%d%d" , i,j);
| |
first second
argument argument

3) like every function returns a value , PRINTF returns the
no. of characters which is inside "...".
eg: printf("%d",printf("hai how are u?"));
the output will be 14.....

4) printf() function is having direct contact with VDU
(video display unit) in the system..... so only it is
displayin every thing in the screen...........

thank u

Is This Answer Correct ?    7 Yes 4 No

Question { 4996 }

Hai why 'c' is the middle language


Answer

C programs are usually written in pure english languages....
so it can be said as high level languages... but at the same
time it can directly operate on Machine level (Bitwise
level) directly... so it can be said as low level
language.... since it is swinging inbetween... C IS CALLED
Middle level language.....


thank u

Is This Answer Correct ?    6 Yes 6 No


Question { 5379 }

Write a program to give following output.....
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********


Answer

#include
#include
void main()
{
int n,i,j,k;
printf("enter the no. of lines :");
scanf("%d",&n);
for(i=1;i<=(n*2-1);i++)
{
if(!(i^1)|| !(i^(n*2-1)))
{
for(j=1;j<=(n*2-1);j++)
printf("*");
}
else
{
if(i<=n)
{
for(j=1;j<=n-i;j++)
printf("*");
for(k=1;k<(2*i);k++)
printf(" ");
for(j=n-i;j>=0;j--)
printf("*");
}
else
{
for(j=1;j<=(i-n+1);j++)
printf("*");
for(j=k-3;k<=(2*n-1);k++)
printf(" ");
for(j=i-n+1;j>0;j--)
printf("*");
}
}
getch();
}


i think this may work

thank u

Is This Answer Correct ?    4 Yes 4 No

Question { 5379 }

Write a program to give following output.....
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********


Answer

sorry i have done a small mistake ..... this is correct

#include
#include
void main()
{
int n,i,j,k;
printf("enter the no. of lines :");
scanf("%d",&n);
for(i=1;i<=(n*2-1);i++)
{
if(!(i^1)|| !(i^(n*2-1)))
{
for(j=1;j<=(n*2-1);j++)
printf("*");
}
else
{
if(i<=n)
{
for(j=1;j<=n-i;j++)
printf("*");
for(k=1;k<(2*(i-1));k++)
printf(" ");
for(j=n-i;j>=0;j--)
printf("*");
if(i==n)
{
k--;
m=k;
}
}
else
{
for(j=1;j<=(i-n+1);j++)
printf("*");
for(j=k;k<=k-n-1;k++)
printf(" ");
k-=2;
for(j=i-n+1;j>0;j--)
printf("*");
}
}
getch();
}

Is This Answer Correct ?    4 Yes 2 No

Question { 23003 }

hi how to convert program from notepad to turboc editor can
u please help me


Answer

1) just save ur notepad program with extension .c or .cpp
2) cut that notepad file from the location and paste it in ur folder where all ur turboC files are stored...
3) open ur Turbo C editor... and open the file which u have pasted... it will be available for u..


thank u

Is This Answer Correct ?    71 Yes 33 No

Question { Wipro, 3476 }

DIFFERNCE BETWEEN THE C++ AND C LANGUAGE?


Answer

1) C is structured oriented language and C++ is an object oriented language
2) in C we must finish our decleration in the very next line of void main() , but in Cpp wherever u need a variable storage data , before that instruction we must declare it......
3) In C structures are used , in that only data members can only be declared and member functions not included , but in Cpp inside a class (same as strucutres) both data members as well as member functions can be used..
4) in Structure all the members and strucutre variables are global by default...... but in Cpp by default the data members are private.....


SIMILARITY :
1) both C & C++ uses Overloading concept....... (very important )

thank u

Is This Answer Correct ?    3 Yes 1 No

Question { 16802 }

write a c program to print a given number as odd or even
without using loop statements,(no if ,while etc)


Answer

#include
#include
void main()
{
int m;
printf("0 - odd number \t 1 - even number\n");
printf("enter the number :");
scanf("%d",&m);
printf(" %d ",m&1);
getch();
}


thank u

Is This Answer Correct ?    43 Yes 27 No

Question { 16802 }

write a c program to print a given number as odd or even
without using loop statements,(no if ,while etc)


Answer

sorry , just change printf() as.... printf("0 - even number \t 1 - odd number \n ");

thank u

Is This Answer Correct ?    12 Yes 19 No

Question { 5530 }

Write a program to compute the following
1!+2!+...n!


Answer

#include
#include
long factorial(int,long);
void main()
{
int i,m;
long sum=0,k=1;
clrscr();
printf("enter ur no. of terms :");
scanf("%d",&m);
i=1;
while(i<=m)
{
k=factorial(i,k);
sum+=k;
i++;
}
printf("the sum is : %ld",sum);
getch();
}
int factorial(int i,long k)
{
return (i*k);
}

hope this also correct...
thank u

Is This Answer Correct ?    3 Yes 0 No

Question { 3608 }

suppose we use switch statement and we intilize years name
using enum statement like(jan,feb,mar,------dec) we take
integer value as an input .question is that the month which
we analyz is from 0 to 11 bt if i enter 12 than how he
again starts from begning and print jan


Answer

enum is a special datatype , whatever we have intilized under enum only we can able to use in our program , hope so ur program contains only enum datatype from that u are giving value for each month through switch case......

so here wat i think is that after u give 11, ie 12th month since u are starting from 0 , if u give 12 inside enum , only 12 entries are there and already u have made use of it.... so again it will start from january only.......

thank u

Is This Answer Correct ?    0 Yes 1 No

Question { 6300 }

what is call by value and call by reference


Answer

CALL BY VALUE :
this means whenever ur arguments in the function contains only values without passing any addresses is called as call by value..

CALL BY REFERENCE :
this means that whenever u pass an address as an arragument when u call an function , that is called as reference by call


thank u

Is This Answer Correct ?    9 Yes 1 No

Question { 7408 }

what is output of the following statetment?Printf(“%x”,
-1<<4); ?


Answer

here the equivalent representation for -1 in memory is it's
two's compliment notation..... so alll the 16 bits will be
HIGH (1).... so four time we are moving the bits left
side.... so after that it will result as 65520.... the
equivalent HEX value for 65520 will get printed.........



thank u

Is This Answer Correct ?    5 Yes 4 No

Question { 4238 }

will the program compile? int i; scanf(“%d”,i); printf(“%d”,i);


Answer

surely it will compile and run , no problem will be in
it.... but the problem lies in ur scanf statement , there
what ever u have typed as an input number , that number
wont be stored in 'i' since you have left ur '&'(reference
operator) , so ur compiler dosen't know where to store ur
input value....... so it will print some garbage value in
the printf().........


thank u

Is This Answer Correct ?    17 Yes 0 No

Question { 4002 }

write a string copy function routine?


Answer

#include
#include
void str_cpy(const char *,const char *);
void main()
{
char a[20],b[20];
printf("enter the string for a[] :");
gets(a);
str_cpy(a,b);
printf("\nthe string for b[] is : ");
puts(b);
getch();
}

void str_cpy(const char *a,const char *b)
{
while((*a)^'\0')
{
*b=*a;
*a++;
*b++;
}
*b='\0';
}


thank u

Is This Answer Correct ?    5 Yes 1 No

Question { Persistent, 8173 }

swap two integer variables without using a third temporary
variable?


Answer

the best way what i choose is that : if x=89 , y=-88

x^=y^=x^=y;

this line will swap the above numbers......


thank u

Is This Answer Correct ?    10 Yes 5 No

Prev    1   2   3    [4]   5   6    Next