0% found this document useful (0 votes)
26 views

Intermediate Coding Assignment

intermediate coding

Uploaded by

Sai Dinesh
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)
26 views

Intermediate Coding Assignment

intermediate coding

Uploaded by

Sai Dinesh
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
You are on page 1/ 5

Intermediate Coding

Assignment 2
Question 1:
The code classifies the entered temperature into different categories based on the range using if-
else control statement range=less than 0 (It's freezing cold), range=0 t0 20(It's a bit chilly),
range=20 t0 30(It's a pleasant day), above 30 (It's quite warm)

Program:

Output:
Question 2:
If the score is valid, the nested if statements determine the grade: 90-100: Grade A, 80-89: Grade
B, 70-79: Grade C, 60-69: Grade D, 0-59: Grade F, If the score is outside the valid range, the
program outputs an error message.

Program:

Output:
Question 3:

bitwise operators and ternary operator

Program & Output:

Question 4:

user is prompted to enter a password, and they are repeatedly asked until they enter the correct
password using do while

Program:

Output:

Question 5:
print the multiplication table of a number up to a specified range using for loop.

Program & Ouput:

Question 6:

#include <stdio.h>
int main() {
int a=0,b=1,c=2,d;
d=++a || b++ && c++ && a++;
printf("%d %d %d %d",a,b,c,d);
return 0;
}
output:

Question 7:
Using the ternary operator to find the largest of three numbers in C.
Program & Output:

Assignment by
- M. Sai Dinesh

HU22CSEN0300193

You might also like