a=2
printf(++a * a++ * a++ * ++a)
answer is 216
how ??
and how is for loop used ?
printf(++a * a++ * a++ * ++a)
answer is 216
how ??
and how is for loop used ?
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:
And this would mean (3*3*5) = 45..clmlbx said:
#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:
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:
QwertyManiac said:
put ur brain into the subject, logic is all u need.clmlbx said:
#include<stdio.h>
int main(void)
{
int i,j;
char a='*';
for(i=6;i>0;i--)
{
for(j=6;j>i;j--)
{
printf(" ");
}
for(j=1;j<i;j++)
{
printf("%c ",a);
}
printf("\n");
}
printf("\n");
for(i=1;i<6;i++)
{
for(j=5;j>i;j--)
{
printf(" ");
}
for(j=1;j<i+1;j++)
{
printf("%c ",a);
}
printf("\n");
}
printf("\n");
return 0;
}
As you expect.