Question 1.Program to Display "HelloWorld"
#include
<stdio.h>
#include
<conio.h>
void main()
{
clrscr();
printf("Hello World");
getch();
}
Question 2. Addition
of Two Number
#include
<stdio.h>
#include
<conio.h>
void main()
{
int fstNo, secNo;
clrscr();
printf("Enter two Nubers:\n");
scanf("%d%d", &fstNo,
&secNo);
printf("Addition is :%d",(fstNo+
secNo));
getch();
}
Question 3.Write a program to display ASCII Value of a character
#include <stdio.h>
#include <conio.h>
void main()
{
char ch;
clrscr();
printf("Enter a character:\n");
scanf("%c", &ch);
printf("ASCII value is %d", ch);
getch();
}
Question 4.Program
to find Quotient and Remainder
#include
<stdio.h>
#include
<conio.h>
void main()
{
clrscr();
int a, b;
printf("Enter
a:\n ");
scanf("%d",
&a);
printf("Enter b:\n ");
scanf("%d", &b);
printf("Quotient
= %d\n",a/b);
printf("Remainder = %d", a%b);
getch();
}
Question
5.Calculate Area of Circle
#include
<stdio.h>
#include
<conio.h>
void main()
{
clrscr();
float r;
printf("Enter the radius of Circle :
\n");
scanf("%f", &r);
printf("\nArea of Circle : %f",3.14
* r * r);
getch();
}
Question 6.
Calculate Area of Square
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int side;
printf("\nEnter the Length of Side : ");
scanf("%d", &side);
printf("\nArea
of Square : %d",side*side);
getch();
}
Question 7.Compute
Area of Rectangle
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int length, breadth;
printf("Enter
the Length of Rectangle : \n");
scanf("%d", &length);
printf("Enter the Breadth of Rectangle : \n");
scanf("%d", &breadth);
printf("Area of Rectangle : %d\n", length
* breadth);
getch();
}
Question 8.Calculate
Simple Interest
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int Principal, rate,
time, si;
printf("\nEnter Principal Amount : ");
scanf("%d",&Principal);
printf("\nEnter
Rate of Interest : ");
scanf("%d",
&rate);
printf("\nEnter
Period of Time : ");
scanf("%d",
&time);
si = (Principal * rate
* time) / 100;
printf("Simple
Interest : %d\n", si);
getch();
}
|
Question 9.Calculate total and average marks of 4 subjects
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int s1, s2,
s3, s4,sum;
float avg;
printf("\nEnter marks of 4 subjects : ");
scanf("%d%d%d%d", &s1, &s2, &s3, &s4);
sum = s1 + s2 + s3 + s4;
printf("Sum : %d\n",sum);
avg = sum /
4;
printf("\nAverage: %f\n", avg);
getch();
}
Question 10.Print Student Details
#include
<stdio.h>
#include
<conio.h>
void main()
{
clrscr();
char name[12];
int age;
float
marks;
printf("\nEnter Student Details
");
scanf("%s%d%f", &name,
&age, & marks);
printf(“Student
Details are : %s\n%d\n%f", name,age,marks);
getch();
}
Question 11.Calculate Area of triangle
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
float b,h;
printf("Enter base \n");
scanf("%f", &b);
printf("Enter height \n");
scanf("%f", &h);
printf("\n Area of triangle : %f",0.5 * b* h);
getch();
}
No comments:
Post a Comment