[go: up one dir, main page]

0% found this document useful (0 votes)
63 views3 pages

100 C Programs TurboC

The document contains five simple C programs demonstrating basic programming concepts. Program 1 prints 'Hello, World!', Program 2 adds two numbers, Program 3 checks if a number is even or odd, Program 4 calculates the factorial of a number using a loop, and Program 5 illustrates the use of pointers. Each program includes standard input and output operations.

Uploaded by

anshs9333
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)
63 views3 pages

100 C Programs TurboC

The document contains five simple C programs demonstrating basic programming concepts. Program 1 prints 'Hello, World!', Program 2 adds two numbers, Program 3 checks if a number is even or odd, Program 4 calculates the factorial of a number using a loop, and Program 5 illustrates the use of pointers. Each program includes standard input and output operations.

Uploaded by

anshs9333
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/ 3

Program 1: Hello World

#include<stdio.h>

#include<conio.h>

void main() {

clrscr();

printf("Hello, World!");

getch();

Program 2: Addition of Two Numbers

#include<stdio.h>

#include<conio.h>

void main() {

clrscr();

int a, b, sum;

printf("Enter two numbers: ");

scanf("%d %d", &a, &b);

sum = a + b;

printf("Sum: %d", sum);

getch();

Program 3: Check Even or Odd

#include<stdio.h>

#include<conio.h>
void main() {

clrscr();

int num;

printf("Enter a number: ");

scanf("%d", &num);

if(num % 2 == 0)

printf("The number is Even.");

else

printf("The number is Odd.");

getch();

Program 4: Factorial Using Loop

#include<stdio.h>

#include<conio.h>

void main() {

clrscr();

int n, i, factorial = 1;

printf("Enter a number: ");

scanf("%d", &n);

for(i = 1; i <= n; i++) {

factorial *= i;

printf("Factorial: %d", factorial);

getch();

}
Program 5: Pointer Example

#include<stdio.h>

#include<conio.h>

void main() {

clrscr();

int a = 10, *ptr;

ptr = &a;

printf("Value of a: %d\n", a);

printf("Address of a: %u\n", ptr);

printf("Value at address stored in ptr: %d", *ptr);

getch();

You might also like