Professional Documents
Culture Documents
232
232
232
h> -----1--------
int main() {
// Loop from 1 to 10
for (int i = 1; i <= 10; i++) {
printf("%d\n", i); // Print the current number
}
return 0;
}
---------------------------------------------------------------------------------
int main() {
int num = 2; // Starting number
return 0;
}
-----------------------------------------------------------------------------------
#include <stdio.h> ---------3-------------
int main() {
int num = 1; // Starting number
int sum = 0; // Variable to store the sum
printf("The sum of numbers from 1 to 50 is: %d\n", sum); // Print the sum
return 0;
}
The sum of numbers from 1 to 50 is: 1275
-----------------------------------------------------------------------------------
-
#include <stdio.h> -------4-----------
int main() {
int number;
unsigned long long factorial = 1; // Factorial can grow large, so we use
unsigned long long to accommodate large numbers
int main() {
int number, sum = 0;
// Infinite loop
while (1) {
// Prompt the user to enter a number
printf("Enter a number (enter 0 to exit): ");
scanf("%d", &number);
return 0;
}
---------------------------------------------------------------------------------
#include <stdio.h> --------6-----------
int main() {
int num, count = 0;
double sum = 0.0, average;
return 0;
}
-----------------------------------------------------------------------------------
---
#include <stdio.h> -------------7-------------------
int main() {
int number;
return 0;
}
-----------------------------------------------------------------------------------
-------
#include <stdio.h> -----8--------
// Function prototype
int max(int a, int b);
int main() {
int num1, num2;
return 0;
}
// Function prototype
int sumOfSquares(int a, int b);
int main() {
int num1, num2;
return 0;
}
// Function prototype
void printPattern();
int main() {
// Call the printPattern function
printPattern();
return 0;
}
// Function prototype
int isPrime(int number);
int main() {
int num;
return 0;
}
return 1; // True
}
-----------------------------------------------------------------------------------
-------
#include <stdio.h> ----------------------12---------------------
// Function prototype
void printMenu();
int main() {
// Call the printMenu function to display the menu
printMenu();
return 0;
}
// Function prototype
void printTable(int number);
int main() {
int num;
// Input the number from the user
printf("Enter a number to print its multiplication table: ");
scanf("%d", &num);
return 0;
}