Note: At First, Solve this Programme Without Using Computer (Use manual tracing for better coding). Then run it in your Computer to Check your Answer.
(a)
#include <stdio.h>
int main()
{
int x=10,y=20, z=5;
y = ++x;
x += 12;
y = x++;
x *= 2;
z = ++y;
printf("%d %d %d”,x,y,z);
return 0;
}
b)
#include <stdio.h>
int main(void) {
int i,j,k,p=0;
for(i=0,j=1;i<=3;i++,j+=3)
{
k=j+j*i;
p=p+k;
}
printf("\nValue is=%d",p);
return 0;
}
c)
#include <stdio.h>
int main(void) {
int i,j,p,q=0,r;
for(i=0,j=1;i<3;i++,j+=2)
{
p = j*j+i;
q = p+q+1;
r = 2*p - q -10;
printf (“\n %d %d %d”,p,q,r);
}
printf("\nSummation =%d",p+q+r);
return 0;
}
download file in here
ReplyDelete