Beruflich Dokumente
Kultur Dokumente
PROGRAM
#include<stdio.h>
void main()
{
float b;
int a;
printf("\nEnteranInteger\n");
scanf("%d",&a);
b=(float)a;
printf("\nTheConvertedfloatvalue is%f",b);
}
OUTPUT
Enter an Integer 45
The Converted float value is 45.00000
RESULT
Thus the c program was written,entered, executed successfully and the output
was verified
AREA OF CIRCLE
PROGRAM
#include<stdio.h>
void main()
{
float r,area;
printf(\nEnter the radius of the circle);
scanf(%f,&r);
area=3.14*r*r;
printf(\nArea=%f,area);
}
OUTPUT
Enter the radius of the circle 4
Area = 50.24
RESULT
Thus the c program was written,entered, executed successfully and the output
was verified
TEMPERATURE CONVERSION
PROGRAM
#include<stdio.h>
void main()
{
floatcel, fah ,c ,f;
clrscr();
printf(\nEnter the Fahrenheit value:);
scanf(%f,&f);
cel=(1.8)*(f-32);
printf(Celsius=%f,cel);
printf(\nEnter the Celsius value:);
scanf(%f,&c);
fah=(1.8)*c+32;
printf(Fahrenheit=%f,fah);
getch();
}
OUTPUT
Enter the Fahrenheit value:8
Celsius = -13.33
Enter the Celsius value:10
Fahrenheit = 50
RESULT
Thus the c program was written,entered, executed successfully and the output
was verified
PROGRAM
#include<stdio.h>
void main()
{
int a,b,c;
float x,y,z;
printf ("Enter the values for a,b,c \n");
scanf("%d%d%d", &a,&b,&c);
x = (a * b) c;
y = (b/c) * a;
z = (a - b) / c
printf(The value of x is %f,x);
printf(The value of y is %f,y);
printf(The value of z is %f,z);
}
OUTPUT
Enter the value for a,b,c.
a= 5; b = 6; c= 12;
x = 28.000
y = 2.5000
z = 0.0555
RESULT
Thus the c program was written,entered, executed successfully and the output
was verified
PROGRAM
#include<stdio.h>
void main()
{
int year;
printf ("Enter the year \n");
scanf("%d", &year);
if (year%4==0)
printf ("It is a Leap Year \n");
else
printf ("It is Not a Leap Year\n");
}
OUTPUT
Enter the year 2004
It is a Leap Year
Enter the year 1998
It is not a Leap Year
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
PROGRAM
#include<stdio.h>
void main()
{
int i,n,sum=0;
printf("Enter the range\n");
scanf("%d",&n);
i=1;
while(i<=n)
{
sum=sum+i;
i++;
}
printf("\nThesumof first%dnumbersis %d\n",n,sum);
}
OUTPUT
Enterthe range
16
The sumof first16numbersis136
RESULT
Thus the c program was written,entered, executed successfully and the output was
verified
OUTPUT
Enter a Number
5891
The Sum of digitis 23
RESULT
Thus the c program was written,entered, executed successfully and the output was
verified
:%d\n,c);
break;
case 3:
c = a * b;
printf(Multiplication
break;
:%d\n,c);
case 4:
c = a / b;
printf(Division
:%d\n,c);
break;
case 0:
exit(0);
break;
}
getch();
}
OUTPUT
1. Addition
2. Subtraction
3. Multiplication
4. Division
0. Exit
Enter Your Choice : 1
Enter the two nos a and b: 2
Addition : 10.
Enter Your Choice : 2
Enter the two nos a and b: 5
Subtraction : 3.
Enter Your Choice : 3
Enter the two nos a and b: 2
Multiplication : 16.
Enter Your Choice : 4.
Enter the two nos a and b: 8
Division : 2.
Enter Your Choice : 0.
Exit.
RESULT
Thus the c program was written,entered, executed successfully and the output was
verified
RESULT
Thus the c program was written,entered, executed successfully and the output was
verified
{
c[i][j]=0;
}
for(k=0;k<3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t \n \n",c[i][j]);}
}
getch();
}
OUTPUT
ENTER 'A'MATRIX
111
222
333
ENTER 'B'MATRIX
123
123
123
________________________
MATRIX MULTIPLICATION
________________________
3
6
9
6
12
18
9
18
2
RESULT
Thus the c program was written,entered, executed successfully and the output was
verified
OUTPUT
Enter the first string
SVS
Enter the second string
SVS College of Engineering
Entered the strings are not equal
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
PROGRAM
#include<stdio.h>
#include<string.h>
void main()
{
char s1[20], s2[20]; \
printf("\nEnter first string:");
gets(s1);
printf("\nEnter second string: ");
gets(s2);
strcat(s1, s2);
printf("\nThe concatenated string is:%s", s1);
getch();
}
OUTPUT
Enter first string: College of
Enter second string: Engineering
The concatenated string is: College ofEngineering
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
PROGRAM
#include<stdio.h>
#include<string.h>
void main()
{
char s1[20], s2[20];
printf("\nEnter string into s1: ");
gets(s1);
strcpy(s2, s1);
printf("\ns2: %s", s2);
getch();
}
OUTPUT
Enter string into s1: Engineering
s2: Engineering
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
PROGRAM
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
charstr[50];
clrscr();
printf("\n\t Enteryour name : ");
gets(str);
printf("\nLower caseof string: %s",strlwr(str));
printf("\nUpper caseof string: %s",strupr(str));
printf("\nReverseof string: %s",strrev(str));
printf("\nLength of String: %d",strlen(str));
getch();
}
OUTPUT
Enteryour name :College
Lower caseof string: college
Upper caseof string: COLLEGE
Reverseof string: EGELLOC
Length of String: 8
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
OUTPUT
Enter a Year
1965
GivenYear is Not a Leap year
RESULT
Thus the c program was written,entered, executed successfully and the output was
verified
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
OUTPUT
Enter totalno.of elements
6
Enter Array Elements onebyone
21
2
9
45
30
11
Array Elemets before sorting
21
45
30
11
11
21
30
45
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
BEFORE SWAPPING:
The value of a and b is: 2
AFTER SWAPPING:
Method is:-Call by Value
The value of a and b is: 2 4
Method is:-Call by Address or Reference
The value of c and d is: 5
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
scanf("%d",&c[i].m4);
}
printf("\n\n\n");
printf("\t\t******************STUDENT DETAILS***************\n");
printf("\t------------------------------------------------------------------\n");
printf("\tNAME \tRNO \tM1 \tM2 \tM3 \tM4 \tTOTAL \tAVERAGE\n");
printf("\t------------------------------------------------------------------\n");
for(i=0;i<n;i++)
{
c[i].tot=c[i].m1+c[i].m2+c[i].m3+c[i].m4;
c[i].avg=(c[i].tot)/4;
printf("\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%.2f\n\n",c[i].s.name,c[i].s.rno,c[i].m1,
c[i].m2,c[i].m3,c[i].m4,c[i].tot,c[i].avg);
}
printf("\t------------------------------------------------------------------\n");
getch();
}
OUTPUT:
ENTER THE VEALUE OF n 2
ENTER NAME,RNO AND MARKS
Sugir 23 95 85 85 95
Jai 12 98 98 78 98
***********************STUDENT DETAILS******************
--------------------------------------------------------------------------------------NAME
RNO M1
M2 M3 M4 TOTAL AVERAGE
---------------------------------------------------------------------------------------Sugi 23
95
85
85
95
360 90.00
Jai
12
98
98
78
98
372 93.00
---------------------------------------------------------------------------------------RESULT
Thus the c program was written, entered, executed successfully and the output was
verified
OUTPUT:
Value Of c.a is = 256
Value Of c.b[0] = 0
Value Of c.b[1] = 1
RESULT
Thus the c program was written, entered, executed successfully and the output was
verified