printf(++a * a++ * a++ * ++a)
how is for loop used ?
for(initialization;condition;value modification){loop body}
for(int i=0;i<10;i++)cprintf("%d",i);
#include<stdio.h>
int main()
{
int a=2;
printf("%d",++a*a++*a++*++a);
}
Seeclmlbx said:a=2
printf(++a * a++ * a++ * ++a)
answer is 216
how ??
and how is for loop used ?
And this would mean (3*3*5) = 45..clmlbx said:what about this
printf(++a*a++*++a)
ans 45
^^^ you mean to say left to right
why did u took
6*6*6*6
what is the difference between pre & post increment
so for ur exp
++a..................*...............a++................... *........a++ ....................* ++a
3 (first incre ..................3 (use then ............. 4(use curren ......................6(coz last a=5)
then use,a=3 now)..........incre,a=4 now)..........then incre,a=5now
#include<stdio.h>
int main(void)
{
int i,j;
for(i=1;i<6;i++)
{
for(j=1;j<i+1;j++)
{
printf("%d ",j);
}
printf("\n");
}
printf("\n");
for(i=1;i<6;i++)
{
for(j=1;j<i+1;j++)
{
printf("* ");
}
printf("\n");
}
printf("\n");
for(i=1;i<6;i++)
{
for(j=1;j<i+1;j++)
{
printf("%d ",i*j);
}
printf("\n");
}
printf("\n");
return 0;
}
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
*
* *
* * *
* * * *
* * * * *
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
Use ur intuition to solve thisclmlbx said:STARTING FROM THE RIGHT SIDE AND ALSO ALIGNED TO RIGHT
AGAIN CAPS.......*gigasmilies.googlepages.com/actions1.gif
What's the value of i++ + i++?
It's undefined. Basically, in C and C++, if you read a variable twice in an expression where you also write it, the result is undefined. Don't do that. Another example is:
v = i++;
Related example:
f(v,i++);
Here, the result is undefined because the order of evaluation of function arguments are undefined.
Having the order of evaluation undefined is claimed to yield better performing code. Compilers could warn about such examples, which are typically subtle bugs (or potential subtle bugs). I'm disappointed that after decades, most compilers still don't warn, leaving that job to specialized, separate, and underused tools.
Look for Output flags (printf flags) in your text book. Do the guys at Ape-tech not teach you ANYTHING at all? These questions are very trivial even for a new programmer!clmlbx said:hi
this all are from left
how can I give output from right ?
means output to right side of screen
QwertyManiac said:Look for Output flags (printf flags) in your text book. Do the guys at Ape-tech not teach you ANYTHING at all? These questions are very trivial even for a new programmer!