0% found this document useful (0 votes)
2 views1 page

Tutorial 3

Uploaded by

hunmoniparker
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Tutorial 3

Uploaded by

hunmoniparker
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

National Institute of Technology Silchar

Department of Computer Science and Engineering


CS221 - Programming and Data Structures
Tutorial 3

Last date for submission: 15-February-2026

1. what will be the values of x and y if n assumes else


the value of (a) 1 and (b) 0 y = 10;
x = 1;
(b) if(x || y || z)
y = 1:
y =10;
if(n > 0)
else
{
z = 0;
x = x+1;
y = y-1; (c) if(x)
} if(y)
z=10;
2. Rewrite the following without using com- else
pound relations z=0;
(a) if (grade ≤ 59 && grade ≥ 50 ) (d) if(x==0 || x&&y)
{ if(!y)
second = second +1; z=0;
} else
(b) if (number > 100 || number < 0) y=1;
printf(“Out of range”);
else 5. Write the looping statement to print the fol-
sum = sum + Number; lowing triangle
1
(c) if((M1 > 60 && M2 >60) || T > 200)
23
printf(“Admitted”);
456
else
7 8 9 10
printf(“Not Admitted”);

3. Assume x = 10, determine the results of the


logical expressions 6. Identify the output of the following code seg-
ment
(a) x == 10 && x>10 && !x for(i=0;i<=5;i++)
(b) x == 10 || x>10 && !x for(j=0;j<=i;j++)
(c) x == 10 || x>10 || !x {
(d) x == 10 || x>10 || !x if(j%i==0)
printf(“%\t”);
4. Assume x=5, y=10. Identify the values after else if(i%2==0)
executing the segments. printf(“\t”);
else if(i%2!=0)
(a) if (x && y ) printf(“#\t”);
x = 10; }

You might also like