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

class 9 C Programs

The document contains a series of C programming exercises that demonstrate basic programming concepts. It includes programs for printing multiplication tables, calculating averages, multiplying numbers, calculating the area of a circle, checking even or odd numbers, and calculating simple interest. Each program is structured with input and output statements, and utilizes basic control structures like loops and conditionals.

Uploaded by

05janvi.m
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)
12 views3 pages

class 9 C Programs

The document contains a series of C programming exercises that demonstrate basic programming concepts. It includes programs for printing multiplication tables, calculating averages, multiplying numbers, calculating the area of a circle, checking even or odd numbers, and calculating simple interest. Each program is structured with input and output statements, and utilizes basic control structures like loops and conditionals.

Uploaded by

05janvi.m
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

1.WAP to print the table of n.

#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int n, i;
printf("Enter a number: ");
scanf("%d", &n);
for (i = 1; i <= 10; i++)
{
printf("%d x %d = %d\n", n, i,n*i);
}
getch();
}
2. WAP to print average of three inputs.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
float num1, num2, num3, average;
printf("Enter three numbers: ");
scanf("%f %f %f", &num1, &num2, &num3);
average = (num1 + num2 + num3) / 3;
printf("The average of the three numbers is: %f\n", average);
getch();
}
3. WAP to multiple any three numbers.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int num1, num2, num3, product;
printf("Enter three numbers: ");
scanf("%d %d %d", &num1, &num2, &num3);
product = num1 * num2 * num3;
printf("%d,%d,%d,Product: %d\n",num1,num2,num3, product);
getch();
}
4. WAP to print multiply N1=30, N2=20, N3=80.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int N1=30, N2=20, N3=80, product;
product = N1 * N2 * N3;
printf("%d,%d,%d,Product: %d\n",N1,N2,N3, product);
getch();
}
5. WAP to print the radius of a circle and calculate its area.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
float radius, area, PI = 3.14159;
printf("Enter the radius of the circle: ");
scanf("%f", &radius);
area = PI * radius * radius;
printf("Radius: %.2f\nArea: %.2f\n", radius, area);
getch();
}
6.WAP to print your name 10 times.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
for (int i = 0; i < 10; i++)
{
printf(“your name\n");
}
getch();
}
7. WAP to check whether number is even or odd.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int number;
printf("Enter an integer: ");
scanf("%d", &number);
if (number % 2 == 0)
{
printf("%d is even.\n", number);
}
else
{
printf("%d is odd.\n", number);
}
getch();
}
8. WAP to calculate Simple Interest.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
float principal, rate, time, simpleInterest;
printf("Enter principal amount: ");
scanf("%f", &principal);
printf("Enter rate of interest: ");
scanf("%f", &rate);
printf("Enter time (in years): ");
scanf("%f", &time);
simpleInterest = (principal * rate * time) / 100;
printf("Simple interest: %.2f\n", simpleInterest);
getch();
}

You might also like