22AIE101 – Problem Solving & C Programming
BTech Computer Science and Engineering (Artificial Intelligence)
Amrita School of Computing, Amrita Vishwa Vidyapeetham,
Amritapuri Campus
Semester – 1
Lab Record
Academic Term: July – Nov 2026
Submitted by:
[Link].U4AIE26131
R K NAVANEETH
Page 1 of 10
Evaluation Rubric & Index
Roll Number: [Link].U4AIE26131 Name: R K Navaneeth
Evaluation Rubric (per lab session)
Criteria Excellent Good Poor Marks
No submission or late
1. Timely Submitted on or before the Late by up to 1 week.
deadline. [Marks: 1] [Marks: 0.5]
without valid reason. 1
Submission [Marks: 0]
2. Correctness of All programs correct and Minor errors or format Incorrect code or poor
follow template. [Marks: 2] deviations. [Marks: 1] structure. [Marks: 0.5]
2
Code
Explains code logic, control Understands code Cannot explain code or
3. Viva: Code
flow, and functions partially, struggles with concepts used. [Marks: 2
Understanding confidently. [Marks: 2] logic. [Marks: 1] 0]
Index
Submission Marks Signed by Lab
Session# Topic
Date (5) Instructor with Date
10
11
12
13
14
15
Page 2 of 10
Lab Report
22AIE101 – Problem Solving & C Programming
Roll Number: [Link].U4AIE26131 Name:R K NAVANEETH
Criteria Excellent Good Poor Marks
1. Timely Submission /1
2. Correctness of Code /2
3. Viva: Code Understanding /2
Total Marks
Faculty Signature with Date:
Lab Session No: 1 Date: 31-07-2026
Question 1: Formatted Student Information
Write a program to read a student’s Roll Number (integer), Percentage (float), and
Grade (character), and display them in the format shown below. [CO1]
Code:
/*
program:Write a program to read a student’s Roll Number (integer), Percentage
(float), and
Grade (character), and display them in the format shown below.
Author:R K Navaneeth
Date:31/7/26
*/
#include <stdio.h>
int main() {
int a;
char c;
float b;
printf("Enter Roll Number : ");
scanf("%d", &a);
printf("Enter Percentage: ");
scanf(" %f", &b);
printf("Enter Grade: ");
scanf(" %c", &c);
printf("\nStudent Details");
printf("\n----------------");
printf("\nRoll no :%d", a);
Page 3 of 10
printf("\nPercentage : %f" , b);
printf("\nGrade : %c\n", c);
return 0;
Testcase 1: Testcase 2:
Enter Roll Number:1 Enter your roll no:2
Enter Grade:A Enter Grade:B
Enter Percentage:90 Enter Percentage:87
Student Details Student Details
---------------- ----------------
Roll no :1 Roll no :2
Grade : A Grade : B
Percentage : 90.000000 Percentage : 87.000000
Question 2: Simple Calculator
Read two integers. Display their addition, subtraction, multiplication, and division [CO1]
Code:
/*
program:Read two integers. Display their addition, subtraction, multiplication,
and division.
Author:R K Navaneeth
Date:31/7/26
*/
#include <stdio.h>
int main() {
int a,b;
printf("enter the no:");
scanf("%d", &a);
printf("enter the no:");
scanf("%d", &b);
printf("addition:%d\n" , a+b);
printf("Subtraction:%d\n" , a-b);
printf("Multiplication:%d\n", a*b);
printf("Division:%d\n", a/b);
return 0;
}
Testcase 1: Testcase 2:
enter the no:1 enter the no:2
enter the no:1 enter the no:1
Page 4 of 10
addition:2 addition:3
Subtraction:0 Subtraction:1
Multiplication:1 Multiplication:2
Division:1 Division:2
Question 3: Swap Two Numbers Without a Temporary Variable
Read two integers and swap their values using arithmetic operators only (no third
variable). Display the values before and after swapping. [CO1]
Code:
/*
* program : Read two integers and swap their values using arithmetic operators
only (no third variable). Display the values before and after swapping.
* author : R K Navaneeth
* date : 31/ 07/26
*/
#include <stdio.h>
int main() {
int x = 9;
int y = 5;
printf("Before Swap:");
printf("\nx = %d", x);
printf("\ny = %d", y);
x = x + y;
y = x - y;
x = x - y;
printf("\n\nAfter Swap:");
printf("\nx = %d", x);
printf("\ny = %d\n", y);
return 0;
}
Testcase 2:
Testcase 1:
Before Swap:
Before Swap:
x = 9
x = 10
y = 5
y = 8
After Swap:
After Swap:
x = 5
x = 8
y = 9
y = 10
Question 4: Temperature Conversion
Read the temperature in Celsius. Convert and display it in Fahrenheit. [CO1]
Page 5 of 10
Code:
/*
program:Read the temperature in Celsius. Convert and display it in Fahrenheit.
Author:R K Navaneeth
Date:31/7/26
*/
#include <stdio.h>
int main() {
float a;
printf("enter the temperature : ");
scanf("%f", &a);
printf("\nTemperature in Celsius: %f\n", (a*9/5)+32);
return 0;
}
Testcase 1: Testcase 2:
enter the temperature : 45 enter the temperature : 56
Temperature in Celsius: 113.000000 Temperature in Celsius: 132.800003
Question 5: Distance Between Two Points
Read the coordinates (x1, y1) and (x2, y2) of two points and calculate the distance
between them using:
(Use the sqrt() function from <math.h>.) [CO1]
Code:
/*
program:Read the coordinates (x1, y1) and (x2, y2) of two points and calculate
the distance
between them using:
Author:R K Navaneeth
Date:31/7/26
*/
#include <stdio.h>
#include <math.h>
int main() {
float x1,x2,y1,y2,d;
printf("enter x1:");
scanf("%f", &x1);
printf("enter y1:");
Page 6 of 10
scanf("%f", &y1);
printf("enter x2:");
scanf("%f", &x2);
printf("enter y2:");
scanf("%f", &y2);
d=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
printf("\nThe distance is %f\n", d);
return 0;
}
Testcase 1: Testcase 2:
enter x1:13 enter x1:5
enter y1:12 enter y1:2
enter x2:14 enter x2:7
enter y2:12 enter y2:6
The distance is 1.000000 The distance is 4.472136
Question 6: Bitwise Operator Practice
Read two integers. Display the results of the bitwise AND, OR, XOR, and left-shift
(by 2 bits) operations on them [CO1]
Code:
#include <stdio.h>
int main(){
int x , y ;
int and,or,xor,leftshift;
printf("Enter two numbers :");
scanf("%d” ,&x);
printf("Enter two numbers :");
Scanf(“%d” ,&y);
and = x & y;
or = x | y ;
xor = x ^ y;
leftshift = x << y;
printf("\nAND : %d" , and);
printf("\nOR : %d" , or);
printf("\nXOR : %d" , xor);
printf("\nLeft-Shift : %d" , leftshift);
return 0 ;
}
Testcase 1: Testcase 2:
Enter numbers :7 Enter numbers :5
Enter numbers :8 Enter numbers :7
Page 7 of 10
AND : 0 AND : 5
OR : 15 OR : 7
XOR : 15 XOR : 2
Left-Shift : 1792 Left-Shift : 640
Question 7: Percentage of Marks
Read the marks obtained by a student in five subjects (out of 100 each). Display the
total marks, average marks, and percentage [CO1]
Code: /*
program:Read the marks obtained by a student in five subjects (out of
100 each). Display the
total marks, average marks, and percentage.
Author:R K Navaneeth
Date:31/7/26
*/
#include <stdio.h>
int main() {
float a,b,c,d,e;
printf("enter your mark:");
scanf("%f", &a);
printf("enter your mark:");
scanf("%f", &b);
printf("enter your mark:");
scanf("%f", &c);
printf("enter your mark:");
scanf("%f", &d);
printf("enter your mark:");
scanf("%f", &e);
printf("Total mark: %f\n" ,a+b+c+d+e);
printf("avg mark: %f\n", (a+b+c+d+e)/5);
printf("percentage: %f\n", ((a+b+c+d+e)/500)*100);
return 0;
}
Testcase 1: Testcase 2:
enter your mark:90 enter your mark:80
enter your mark:90 enter your mark:80
enter your mark:90 enter your mark:80
enter your mark:90 enter your mark:67
enter your mark:90 enter your mark:78
Total mark: 450.000000 Total mark: 385.000000
avg mark: 90.000000 avg mark: 77.000000
Page 8 of 10
percentage: 77.000000
percentage: 90.000000
Question 8: Print Formatted Receipt
Write a program to display the following output using variables (no conditionals or
loops – print each line directly). [CO1]
=================================
SHOP RECEIPT
=================================
Item Qty Price
Pen 2 20
Book 1 150
Pencil 5 25
---------------------------------
Total 195
=================================
Code: /*
program:Write a program to display the following output using variables
(no conditionals or loops – print each line directly)
Author:R K Navaneeth
Date:31/7/26
*/
#include <stdio.h>
int main() {
printf("=====================================\n");
printf(" SHOP RECEIPT \n");
printf("=====================================\n");
printf("Item Qty price\n");
printf("Pen 2 20\n");
printf("Book 1 150\n");
printf("Pencil 5 25\n");
printf("--------------------------------------\n");
printf("Total 195\n");
printf("======================================\n");
return 0;
Page 9 of 10
}
Testcase 1:
=====================================
SHOP RECEIPT
=====================================
Item Qty price
Pen 2 20
Book 1 150
Pencil 5 25
--------------------------------------
Total 195
=====================================
Page 10 of 10