DATABASE ASSIGNMENT 1& 2
DATABASE ASSIGNMENT 1& 2
Answer
#include <stdio.h>
int main() {
int i;
printf("\n");
return 0;
QN.2. Write a program in C to display the cube of the number up to given an integer.
#include <stdio.h>
int main() {
// Declare variables to store the given integer and the current cube
int n, cube;
scanf("%d", &n);
cube = i * i * i;
return 0;
#include <stdio.h>
int main(){
int i;
printf("Hello\n");
return 0;
Answer
#include <stdio.h>
if (count == 10) {
return;
// Print "Hello" and recursively call the function with incremented count
printf("Hello\n");
printHello(count + 1);
int main() {
printHello(1);
return 0;
QN.4.
What would be the output of:
#include <stdio.h>
display(){
printf("C\n");
main();
int main(){
printf("Hey\n");
display();
return 0;
Answer
Hey
Answer
#include <stdio.h>
int main() {
// Declare variables for quantity, unit price, total cost, and discount
int quantity;
scanf("%d", &quantity);
// Check if the total cost is more than 1000 and apply the discount
total_cost -= discount;
return 0;
}
b. Grading system based on marks
#include <stdio.h>
int main() {
int marks;
char grade;
scanf("%d", &marks);
grade = 'F';
grade = 'E';
grade = 'D';
grade = 'C';
grade = 'B';
} else {
grade = 'A';
return 0;
}