12th Codeing
12th Codeing
#include <stdio.h>
int main() {
return 0;
}
Practical 02
#include <stdio.h>
int main() {
char name[50];
int age;
float height;
char gender;
return 0;
}
Practical 03
#include <stdio.h>
#include <math.h>
int main() {
float base, height, radius;
float area, volume;
return 0;
}
Practical 04
#include <stdio.h>
int main() {
int i, j;
return 0;
}
Practical 05 (a)
#include <stdio.h>
int main() {
int totalMarks = 0;
int count = 0;
char continueInput;
do {
scanf("%d", &numSubjects);
totalMarks = 0;
count = 0;
scanf("%d", &marks);
if (marks < 0) {
continue; // Skip the rest of the loop and ask for marks again
totalMarks += marks;
count++;
i++; // Increment subject counter
// Calculate average
if (count > 0) {
} else {
printf("Do you want to calculate average for another student? (y/n): ");
printf("Thank you!\n");
return 0;
}
Practical 05 (b)
#include <stdio.h>
int main() {
int numSubjects;
char continueInput;
do {
scanf("%d", &numSubjects);
int totalMarks = 0;
int count = 0;
int marks;
while (validInput == 0) {
scanf("%d", &marks);
if (marks < 0) {
} else {
totalMarks += marks;
// Calculate average
if (count > 0) {
} else {
printf("Do you want to calculate average for another student? (y/n): ");
printf("Thank you!\n");
return 0;
}
Practical 06
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
if (n < 0) {
int i = 1;
while (i <= n) {
i++; // Increment i
return 0;
}
Practical 07 (a)
#include <stdio.h>
int main() {
scanf("%d", &rows);
scanf("%d", &cols);
printf("\nCheckboard Pattern:\n");
if ((i + j) % 2 == 0) {
} else {
return 0;
}
Practical 07 (b)
#include <stdio.h>
int main() {
scanf("%d", &rows);
scanf("%d", &cols);
scanf("%d", &squareSize);
printf("\nCheckboard Pattern:\n");
if ((i + j) % 2 == 0) {
if (k == 0 || k == squareSize - 1 || l == 0 || l == squareSize - 1) {
printf("%c ", char1); // Print border character
} else {
} else {
if (k == 0 || k == squareSize - 1 || l == 0 || l == squareSize - 1) {
} else {
return 0;
}
Practical 08
#include <stdio.h>
int main() {
int choice;
do {
printf("7. Exit\n");
scanf("%d", &choice);
switch (choice) {
scanf("%f", &temperature);
break;
break;
scanf("%f", &temperature);
break;
scanf("%f", &temperature);
break;
scanf("%f", &temperature);
break;
scanf("%f", &temperature);
break;
case 7: // Exit
break;
break;
return 0;
}
Practical 09
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
if (n < 0) {
} else {
return 0;
}
Practical 10
#include <stdio.h>
printf("*");
draw_rectangle(side_length, side_length);
int main() {
printf("Drawing Rectangles:\n");
draw_rectangle(5, 3);
draw_rectangle(10, 4);
printf("\nDrawing Squares:\n");
// Draw different squares
draw_square(5);
draw_square(8);
return 0;