C language - 50 Program
Q1 WAP in c to display "Hello C Program" on the Screen.
#include
//#include
//void main() {
int main()
{
printf("Hello C Program");
return 0;//getch();
}
Output-
Hello C Program
Q2 WAP in c to perform addition of two numbers.
#include
//#include
//void main() {
int main()
{
int a,b,c;
//clracr();
printf("Enter Value of a And b\n");
scanf("%d %d",&a, &b);
c=a+b;
printf("value c is %d",c);
return 0;//getch();
}
output- Enter Value of a And b
5
6
value c is 11
Q3 WAP in c to calculate simple interest.
#include
//#include
//void main() {
int main()
{
int r,p,t,si;
//clracr();
printf("Enter Value of Interest Rate ,Principal Amount And Time(Year) \n");
scanf("%d %d %d",&r, &p, &t);
si=p*r*t/100;
printf("si=%d",si);
return 0;//getch();
}
output-
Enter Value of Interest Rate ,Principal Amount And Time(Year)
12
10000
1
si=1200
Q4 WAP in c to calculate area and perimeter of a circle.
#include
//#include
//void main() {
int main()
{
float redius, area, prem;
//clracr();
printf("enter redius");
scanf("%f",&redius);
area=3.14*redius*redius;
prem=2*3.14*redius;
printf("area of circle:%f \n perimeter of circle : %f \n", area, prem);
return 0;//getch();
}
output- enter redius5
area of circle:78.500000
perimeter of circle : 31.400000
Q5 WAP in c to calculate area and perimeter of rectangle.
#include
//#include
//void main() {
int main()
{
int l,b,prem,area;
//clracr();
printf("enter the value of l and b\n");
scanf("%d %d",&l,&b);
prem=(l+b)+(l+b);
area=l*b;
printf("perimeter : %d area %d", prem,area);
return 0;//getch();
}
output- enter the value of l and b
10
5
perimeter : 30 area 50
Q6 WAP in c to calculate area and perimeter of square.
#include
//#include
//void main() {
int main()
{
float side, area, peri ;
//clracr();
printf("enter the side of square:\n");
scanf("%f",&side);
area=(side*side);
peri=4*side;
printf("area of square:%f\n",area);
printf("perimeter of square: %f \n", peri);
return 0;//getch();
}
output- enter the side of square:
8
area of square:64.000000
perimeter of square: 32.000000
Q7 WAP in c to calculate area and perimeter of triangle.
#include
#include
//#include
//void main() {
int main()
{
float side1, side2, side3,perimeter, s, area;
//clracr();
printf("enter the length of side1, side2, side3 :\n");
scanf("%f%f%f",&side1,&side2,&side3);
perimeter=side1+side2+side3;
s=perimeter/2;
area=sqrt(s*(s-side1)*(s-side2)*(s-side3));
printf("perimeter of the trinangle :%f\n",perimeter);
printf("area of the trinangle :%f\n",area);
return 0;//getch();
}
output- enter the length of side1, side2, side3 :
5
7
9
perimeter of the trinangle :21.000000
area of the trinangle :17.412281
Q8 WAP in c to calculate volume and surface area of cube.
#include
//#include
//void main() {
int main()
{
float side, v, sa ;
//clracr();
printf("enter the side lenght of the cube :\n");
scanf("%f",&side);
v=side*side*side;
sa=6*side*side;
printf("volume of the cube:%f\n",v);
printf("surface area of the cube:%f\n",sa);
return 0;//getch();
}
output-
enter the side lenght of the cube :
5
volume of the cube:125.000000
surface area of the cube:150.000000
Q9 WAP in c to calculate suface area and volume of cuboid .
#include
//#include
//void main() {
int main()
{
float l,w,h,volume,sa;
//clracr();
printf("enter the lenght, width and height of cuboid:\n");
scanf("%f%f%f",&l,&w,&h);
volume=l*w*h;
sa=2*(l*w+l*h+w*h);
printf("volume of cuboid:%f\n",volume);
printf("surface area of cuboid:%f\n",sa);
return 0;//getch();
}
output-
enter the lenght, width and height of cuboid:
3.5
2.0
4.8
volume of cuboid:33.600002
surface area of cuboid:66.800003
Q10 WAP in c to calculate volume and surface area of cone.
#include
#include
//#include
//void main() {
int main()
{
float r, h ;
//clracr();
printf("enter the radius and height of cone:\n");
scanf("%f%f",&r,&h);
float sh=sqrt(r*r+h*h);
float sa=3.14*r*(r+sh);
float v=(1.0/3.0)*3.14*r*r*h;
printf("surface area of the cone: %f\n",sa);
printf("volume of the cone:%f\n",v);
return 0;//getch();
}
output-
enter the radius and height of cone:
5
8
surface area of the cone: 226.613495
volume of the cone:209.333328
Q11 WAP in c to calculate volume and surface area of cylinder .
#include
#include
//#include
//void main() {
int main()
{
float r,h,sa,v ;
//clracr();
printf("enter the radius and height of cylinder:\n");
scanf("%f%f",&r,&h);
sa=2*(22/7)*r*(r+h);
v=(22/7)*r*r*h;
printf("surface area of cylinde: %f\n",sa);
printf("volume of cylinde:%f\n",v);
return 0;//getch();
}
output-
enter the radius and height of cylinder:
15
17
surface area of cylinde: 2880.000000
volume of cylinde:11475.000000
Q 12 WAP in c to calculate volume and surface area of sphere .
#include
#include
//#include
//void main() {
int main()
{
float r,sa,v ;
//clracr();
printf("enter the radius of sphere:\n");
scanf("%f",&r);
sa=4*(22/7)*r*r;
v=(4.0/3)*(22/7)*r*r*r;
printf("surface area of sphere: %f\n",sa);
printf("volume of sphere:%f\n",v);
return 0;//getch();
}
output-
enter the radius of sphere:
40
surface area of sphere: 19200.000000
volume of sphere:256000.000000
Q13 WAP in c to convert temperature from degree to fahrenheit.
#include
#include
//#include
//void main() {
int main()
{
float celsius, fahrenheit;
printf("enter temperature in celsius:\n");
scanf("%f",&celsius);
fahrenheit=(celsius*9/5)+32;
printf("%f celsius=%ffahrenheit",celsius,fahrenheit );
return 0;//getch();
}
output-
enter temperature in celsius:
100
100.000000 celsius=212.000000fahrenheit
Q14 WAP in c to calculate sum of first 10 natural number.
#include
//#include
//void main() {
int main()
{
int n=10;
//clracr();
int sum=n*(n+1)/2;
printf("sum of first 10 natural numbers:%d\n",sum);
return 0;//getch();
}
output-
sum of first 10 natural numbers:55
Q15 WAP in c to check given no is even or odd.
#include
//#include
//void main() {
int main()
{
int a;
//clrscr();
printf("enter the value a:");
scanf("%d",&a);
if(a%2==0)
printf("number is even:%d\n",a);
else
printf("number is odd:%d\n",a);
return 0;//getch();
}
output-
enter the value a:46
number is even:46
Q 16 WAP in c to find larger b/w two numbers .
#include
//#include
//void main() {
int main()
{
int a,b;
//clrscr();
printf("enter the value a and b:");
scanf("%d%d",&a,&b);
if(a>b)
printf("a is larger number:%d\n",a);
else
printf("b is larger number:%d\n",b);
return 0;//getch();
}
output-
enter the value a and b:50
100
b is larger number:100
Q17 WAP in c to check your eligibility to give vote .
#include
//#include
//void main() {
int main()
{
int age;
//clrscr();
printf("enter the value age:");
scanf("%d",&age);
if(age>=18)
printf("eligible for voting");
else
printf("not eligible for voting");
return 0;//getch();
}
output-
enter the value age:17
not eligible for voting
Q18 WAP in c to check entered year is leap year or not .
#include
//#include
//void main() {
int main()
{
int year;
//clrscr();
printf("enter the year:");
scanf("%d",&year);
if(year%2==0)
printf("this is leap year");
else
printf("this is not leap year");
return 0;//getch();
}
output-
enter the year:2024
this is leap year
Q19 WAP in c to find largest among three numbers .
#include
//#include
//void main() {
int main()
{
int a,b,c;
//clrscr();
printf("enter input\n");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
if(a>c)
printf("a is largest number");
else
printf("b is largest number");
else
if(b>c)
printf("b is largest number");
else
printf("c is largest number");
return 0;//getch();
}
output-
enter input
232
345
567
c is largest number
Q20 WAP in c to check entered number is +ve,-ve or equal to zero .
#include
//#include
//void main() {
int main()
{
int n=0;
//clrscr();
printf("enter number:");
scanf("%d",&n);
if(n>0)
printf("\n%d:positive number",n);
else if(n<0)
printf("\n%d:negative number",n);
else
printf("\n:zero");
return 0;//getch();
}
output-
enter number:55
55:positive number
enter number:-55
-55:negative number
enter number:0
:zero
Q21 WAP in c to find nature of roots of a Quadretic equation .
#include
#include
//#include
//void main() {
int main()
{
float a,b,c,d,r1,r2;
//clrscr();
printf("enter the value of a,b and c:");
scanf("%f%f%f",&a,&b,&c);
d=b*b-4*a*c;
if(d==0)
{
printf("the roots are real and equal\n");
r1=-b/(2*a);
r2=-b/(2*a);
printf("roots 1 is %f and roots2 is %f \n",r1,r2);
}
else if (d>0)
{
printf("roots are real and different \n");
r1=(-b+sqrt(d))/(2*a);
r2=(-b-sqrt(d))/(2*a);
printf("root 1 is %f and root2 is %f \n",r1,r2);
}
else
{
printf("roots are imaginary\n");
}
return 0;//getch();
}
output-
enter the value of a,b and c:1
4
4
the roots are real and equal
roots 1 is -2.000000 and roots2 is -2.000000
enter the value of a,b and c:
2
4
6
roots are imaginary
###Q22 WAP in c to find root of a quadratic eqation.
#include
//#include
//void main() {
int main()
{
int ;
//clracr();
return 0;//getch();
}
output-
Q23 WAP in c to check entered alphabet is vowel or consonant .
#include
#include
//#include
//void main() {
int main()
{
char ch;
//clrscr();
printf("enter any charactor:");
scanf("%c",&ch);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')
{
printf("character is Vowel");
}
else
{
printf("character is Consonant");
}
return 0;//getch();
}
output- enter any charactor:K
character is Consonant
enter any charactor:i
character is Vowel
Q24 WAP in c to find day of the week using switch case .
#include
//#include
//void main() {
int main()
{
int ch;
//clrscr();
printf("enter user chouce:");
scanf("%d",&ch);
switch(ch)
{
case 1:printf("monday");
break;
case 2:printf("tuesday");
break;
case 3:printf("wednesday");
break;
case 4:printf("thrusday");
break;
case 5:printf("friday");
break;
case 6:printf("saturday");
break;
case 7:printf("sunday");
break;
default:printf("Invalid user choice!!");
}
return 0;//getch();
}
output- enter user chouce:2
tuesday
Q25 WAP in c to calculate area of circle, square, rectangle and tringle using switch case.
#include
//#include
//void main() {
int main()
{
int choice;
float area;
//clrscr();
printf("choose a shap to calculate area :\n");
printf("1.Circle\n2.Sqare\n3.Rectangle\n4.Triangle:\n");
scanf("%d",&choice);
switch(choice)
{
case 1:{
float redius;
printf("enter the redius circle:");
scanf("%f",&redius);
area=3.14*redius*redius;
break;
}
case 2:{
float side;
printf("enter the side of square:");
scanf("%f",&side);
area=side*side;
break;
}
case 3:{
float length,width;
printf("enter the length and width of the rectangle:");
scanf("%f%f",&length, &width);
area=length*width;
break;
}
case 4:{
float base, height;
printf("enter the base and height of the triangle:");
scanf("%f%f",&base,&height);
area=0.5*base*height;
break;
}
default:
printf("invalid choice\n");
}
printf("The calculated area is: %.2f\n", area);
return 0;//getch();
}
output-
choose a shap to calculate area :
1.Circle
2.Sqare
3.Rectangle
4.Triangle:
1
enter the redius circle:5
The calculated area is: 78.50
2
enter the side of square:5
The calculated area is: 25.00
3
enter the length and width of the rectangle:5
10
The calculated area is: 50.00
4
enter the base and height of the triangle:5
7
The calculated area is: 17.50
Q26 WAP in c to calculate volume of cube, cuboid, cone, cylinder and sphere
using switch case .
#include
#include
//#include
//void main() {
int main()
{
int choice;
double length, width, height, radius;
//clrscr();
printf("Enter shape to calculate volume:\n");
printf("1. Cube\n2. Cuboid\n3. Cone\n4. Cylinder\n5. Sphere\n");
scanf("%d", &choice);
switch(choice)
{
case 1:
{
printf("Enter the length of the cube: ");
scanf("%lf", &length);
printf("Volume of the cube: %.2f\n", length * length * length);
break;
}
case 2:
{
printf("Enter the length, width, and height of the cuboid: ");
scanf("%lf%lf%lf", &length, &width, &height);
printf("Volume of cuboid: %.2f\n", length * width * height);
break;
}
case 3:
{
printf("Enter the radius and height of the cone: ");
scanf("%lf%lf", &radius, &height);
printf("Volume of cone: %.2f\n", (M_PI * pow(radius, 2) * height) / 3);
break;
}
case 4:
{
printf("Enter the radius and height of the cylinder: ");
scanf("%lf%lf", &radius, &height);
printf("Volume of cylinder: %.2f\n", M_PI * pow(radius, 2) * height);
break;
}
case 5:
{
printf("Enter the radius of the sphere: ");
scanf("%lf", &radius);
printf("Volume of sphere: %.2f\n", (4 * M_PI * pow(radius, 3)) / 3);
break;
}
default:
printf("Invalid choice\n");
}
return 0;
//getch();
}
output-
Enter shape to calculate volume:
1. Cube
2. Cuboid
3. Cone
4. Cylinder
5. Sphere
1
Enter the length of the cube: 3
Volume of the cube: 27.00
2
Enter the length, width, and height of the cuboid: 3.5
2.0
4.8
Volume of cuboid: 33.60
3
Enter the radius and height of the cone: 8
9
Volume of cone: 603.19
4
Enter the radius and height of the cylinder: 8
4
Volume of cylinder: 804.25
5
Enter the radius of the sphere: 8
Volume of sphere: 2144.66
Q27 WAP in c to perform all arithmetic oprations(addition, subtraction,
multiplication,division and modules) using switch case.
#include
//#include
//void main() {
int main()
{
int a,b,c,choice;
//clrscr();
printf("enter two numbers:\n");
scanf("%d%d", &a,&b);
printf("\n Menu:\n1.Addition\n2.subtraction\n3.Multiplication\n4.Division\nEnter Your Choice:");
scanf("%d",&choice);
switch(choice)
{
case 1: c=a+b;
printf("Result of addition is %d",c);
break;
case 2: c=a-b;
printf("Result of addition is %d",c);
break;
case 3: c=a*b;
printf("Result of addition is %d",c);
break;
case 4: c=a/b;
printf("Result of addition is %d",c);
break;
default:
printf("Invalid choice\n");
}
return 0;
//getch();
}
output-
enter two numbers:
4
2
Menu:
1.Addition
2.subtraction
3.Multiplication
4.Division
Enter Your Choice:1,2,3,4
Result of addition is 6
Result of subtraction is 2
Result of Multiplication is 8
Result of Division is 2
Q28 WAP in c to check entered alphabet is vowel or consonant using switch case.
#include
//#include
//void main() {
int main()
{
char z;
//clrscr();
printf("enter any charactor:\n");
scanf("%c", &z);
switch(z)
{
case 'A':
case 'a':
printf("%c is a Vowel",z);
break;
case 'E':
case 'e':
printf("%c is a Vowel",z);
break;
case 'I':
case 'i':
printf("%c is a Vowel",z);
break;
case 'O':
case 'o':
printf("%c is a Vowel",z);
break;
case 'U':
case 'u':
printf("%c is a Vowel",z);
break;
default:
printf("%c is a consonant",z);
}
return 0;
//getch();
}
output- enter any charactor:
a
a is a Vowel
enter any charactor:
k
k is a consonant
Q29 WAP in c to display table of any number, entered by user(using for loop) .
#include
//#include
//void main() {
int main()
{
int num, i;
//clrscr();
printf("enter any number:\n");
scanf("%d", &num);
printf("Multiplication Table of %d is:\n",num);
for(i=0;i<10;i++)
{
printf("%dX%d=%d\n",num,i+1,num*(i+1));
}
return 0;
//getch();
}
output-
enter any number:
2
Multiplication Table of 2 is:
2X1=2
2X2=4
2X3=6
2X4=8
2X5=10
2X6=12
2X7=14
2X8=16
2X9=18
2X10=20
Q30 WAP in c to display table of any number, entered by user(using while loop).
#include
//#include
//void main() {
int main()
{
int num,i=1;
//clrscr();
printf("enter a number:\n");
scanf("%d", &num);
printf("table of %d:\n",num);
while(i<=10)
{
printf("%dX%d=%d\n",num,i,num*i);
i++;
}
return 0;
//getch();
}
output-
enter a number:
3
table of 3:
3X1=3
3X2=6
3X3=9
3X4=12
3X5=15
3X6=18
3X7=21
3X8=24
3X9=27
3X10=30
Q31 WAP in c to display table of any number, entered by user(using do while loop).
#include
//#include
//void main() {
int main()
{
int num,i=1;
//clrscr();
printf("enter a number:\n");
scanf("%d", &num);
printf("table of %d:\n",num);
do
{
printf("%dX%d=%d\n",num,i,num*i);
i++;
}
while(i<=10);
return 0;
//getch();
}
output-
enter a number:
6
table of 6:
6X1=6
6X2=12
6X3=18
6X4=24
6X5=30
6X6=36
6X7=42
6X8=48
6X9=54
6X10=60
Q32 WAP in c to find sum of first 10 numbers using for loop .
#include
//#include
//void main() {
int main()
{
int i;
int sum=0;
for(i=1;i<=10;i++)
sum=sum+i;
printf("\t sum of the first 10 natural numbers is =%d\n",sum);
return 0;
//getch();
}
output-
sum of the first 10 natural numbers is =55
Q33 WAP in c to calculate factorial of a number using loop.
#include
//#include
//void main() {
int main()
{
int i,n,fact=1;
printf("Enter number:");
scanf("%d",&n);
i=n;
while(i>=1)
{
fact=fact*i;
i--;
}
printf("factorial=%d",fact);
return 0;
//getch();
}
output-
Enter number:5
factorial=120
Q34 WAP in c to find sum of digits of a number.
#include
//#include
//void main() {
int main()
{
int n,sum=0,r;
printf("Enter any number:");
scanf("%d",&n);
while(n>0)
{
r=n%10;
sum=sum+r;
n=n/10;
}
printf("sum of digit: %d",sum);
return 0;
//getch();
}
output-
Enter any number:45678
sum of digit: 30
Q35 WAP in c to reverse an entered number .
#include
//#include
//void main() {
int main()
{
int n,r;
printf("Enter number:");
scanf("%d",&n);
while(n>0)
{
r=n%10;
printf("%d",r);
n=n/10;
}
return 0;
//getch();
}
output-
Enter number:17844
44871
Q36 WAP in c to check entered number is palindrome or not .
#include
//#include
//void main() {
int main()
{
int n,c,s=0,r;
printf("Enter any number:");
scanf("%d",&n);
c=n;
while(n>0)
{
r=n%10;
s=r+(s*10);
n=n/10;
}
if(c==5)
printf("Pelindrome Number");
else
printf("Not");
return 0;
//getch();
}
output- Enter any number:5
Pelindrome Number
Enter any number:66
Not
Q37 WAP in c to check entered number is prime or not .
#include
//#include
//void main() {
int main()
{
int n,count=0,i;
printf("Enter any number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count==2)
printf("Prime Number");
else
printf("Not Prime Number");
return 0;
//getch();
}
output-
Enter any number:-3
Not Prime Number
Q38 WAP in c to display array of 10 elements .
#include
//#include
//void main() {
int main()
{
int a[10],i;
printf("Enter array elements:");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("\n array element: ");
for(i=0;i<10;i++)
{
printf("%d ", a[i]);
}
return 0;
//getch();
}
output-
Enter array elements:89 56 45 67 98 56 45 32 65 89
array element: 89 56 45 67 98 56 45 32 65 89
Q39 WAP in c to reverse array of 10 elements .
#include
//#include
//void main() {
int main()
{
int a[10],i;
printf("Enter array elements:");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("\n Reverse array element: ");
for(i=9;i>=0;i--)
{
printf("%d ", a[i]);
}
return 0;
//getch();
}
output-
Enter array elements:12 23 45 56 78 89 13 46 79 37
Reverse array element: 37 79 46 13 89 78 56 45 23 12
Q40 WAP in c to find sum of array of 10 elements .
#include
//#include
//void main() {
int main()
{
int a[10],sum=0,i;
printf("Enter 10 array elements:");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
printf("\n sum of 10 array element: ");
for(i=0;i<10;i++)
{
sum=sum+a[i];
}
printf("%d ", sum);
return 0;
//getch();
}
output-
Enter 10 array elements:98 98 78 45 12 23 56 45 89 89
sum of 10 array element: 633
Q 41 Write a Program in C language to Display matrix of Order 2 X 4
Ans-
#include
//#include
//void main() {
int main() {
int matrix[2][4] = {
{1, 2, 3, 4},
{5, 6, 7, 8}
};
printf("Matrix of Order 2x4:\n");
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 4; ++j) {
printf("%d\t", matrix[i][j]);
}
printf("\n");
}
return 0;
}
-------------------------------
Output -
Matrix of Order 2x4:
1 2 3 4
5 6 7 8
Q 42 Write a Program in C language to perform Addition Of Two matrix
#include
//#include
//void main() {
int main() {
int m, n, i, j;
printf("Enter the number of rows and columns of the matrices: ");
scanf("%d%d", &m, &n);
int a[m][n], b[m][n], c[m][n];
printf("Enter the elements of matrix A: \n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &a[i][j]);
}
}
printf("Enter the elements of matrix B: \n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &b[i][j]);
}
}
// add the matrices
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
c[i][j] = a[i][j] + b[i][j];
}
}
// print the result
printf("The sum of the two matrices is: \n");
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("%d ", c[i][j]);
}
printf("\n");
}
return 0;
}
------------------------------
Output -
Enter the number of rows and columns of the matrices: 2
2
Enter the elements of matrix A:
9
8
7
4
Enter the elements of matrix B:
9
8
10
12
The sum of the two matrices is:
18 16
17 16
Q 43 Write a Program in C language to Swap Two numbers using function (call by value )
#include
//#include
void swap(int x, int y)
{
int temp;
temp = x;
x = y;
y = temp;
printf("\nAfter swapping: a = %d and b = %d\n", x, y);
}
void swap(int, int);
int main()
{
int a, b;
printf("Enter values for a and b\n");
scanf("%d%d", &a, &b);
printf("\n\nBefore swapping: a = %d and b = %d\n", a, b);
swap(a, b);
return 0;
}
------------------------------
Output -
Enter values for a and b
50
20
Before swapping: a = 50 and b = 20
After swapping: a = 20 and b = 50
Q 44 Write a Program in C language to Swap Two numbers using function (Call by address )
#include
void swapNumbers(int *num1, int *num2) {
int temp;
temp = *num1;
*num1 = *num2;
*num2 = temp;
}
int main() {
int num1, num2;
printf("Enter first number: ");
scanf("%d", &num1);
printf("Enter second number: ");
scanf("%d", &num2);
swapNumbers(&num1, &num2);
printf("After swapping: num1 = %d, num2 = %d\n", num1, num2);
return 0;
}
--------------------------
Output -
Enter first number: 50
Enter second number: 100
After swapping: num1 = 100, num2 = 50
Q 45 Write a Program in C language to find Length of a string
#include
#include
//#include
int main()
{
char Str[1000];
int i;
printf("Enter the String: ");
scanf("%s", Str);
for (i = 0; Str[i] != '\0'; ++i);
printf("Length of Str is %d", i);
return 0;
}
------------------------------
Output -
Enter the String: jai_shree_ram
Length of Str is 13
Q 46 Write a Program in C language to To concatenate (add) two strings
#include
//#include
int main()
{
char str1[100] = "RAJENDRA ", str2[100] = "AASERI SIR";
char str3[100];
int i = 0, j = 0;
printf("\nFirst string: %s", str1);
printf("\nSecond string: %s", str2);
while (str1[i] != '\0') {
str3[j] = str1[i];
i++;
j++;
}
i = 0;
while (str2[i] != '\0') {
str3[j] = str2[i];
i++;
j++;
}
str3[j] = '\0';
printf("\nConcatenated string: %s", str3);
return 0;
}
------------------------------
Output -
First string: RAJENDRA
Second string: AASERI SIR
Concatenated string: RAJENDRA AASERI SIR
Q 47 Write a Program in C language To Copy one string into another string
#include
//#include
int main() {
char s1[1000];
char s2[1000];
printf("Enter any string: ");
gets(s1);
int i;
for(i=0;s1[i]!='\0';i++) {
s2[i]=s1[i];
}
s2[i]='\0';
printf("original string s1='%s'\n",s1);
printf("copied string s2='%s'",s2);
return 0;
}
------------------------------
Output -
Enter any string: RAMAYANA
original string s1='RAMAYANA'
copied string s2='RAMAYANA'
Q 48 Write a Program in C language to perform all arithmetic operations using function
#include
//#include
int addition(int num1, int num2)
{
int sum = num1 + num2;
return sum;
}
int subtraction(int num1, int num2)
{
return num1 - num2;
}
int multiplication(int num1, int num2)
{
return num1 * num2;
}
float division(int num1, int num2)
{
return num1 / num2;
}
int modulus(int num1, int num2)
{
return num1 % num2;
}
int main()
{
int num1, num2;
printf("Enter the First Number = ");
scanf("%d",&num1);
printf("Enter the Second Number = ");
scanf("%d",&num2);
printf("Arithemetic Operations on Integer Values\n");
printf("Addition = %d\n", addition(num1, num2));
printf("subtraction = %d\n", subtraction(num1, num2));
printf("multiplication = %d\n", multiplication(num1, num2));
printf("division = %.2f\n", division(num1, num2));
printf("modulus = %d\n", modulus(num1, num2));
}
------------------------------
Output -
Enter the First Number = 10
Enter the Second Number = 10
Arithemetic Operations on Integer Values
Addition = 20
subtraction = 0
multiplication = 100
division = 1.00
modulus = 0
Q 49 Write a Program in C language to Find simple interest using pointer
#include
//#include
int main() {
float p, t, r, SI;
// `p` = principal, `t` = time, and `r` = rate
// `SI` = value of the simple interest
float *x, *y, *z; // These are the pointer variables
printf("Enter the principal (amount), time(in Year), and rate::\n");
scanf("%f%f%f", &p, &t, &r);
x = &p;
y = &t;
z = &r;
// It will calculate the value of simple interest
SI = (*x * *y * *z) / 100;
// It will produce the final output
printf("\nSimple Interest = %.2f\n", SI);
return 0;
}
------------------------------
Output -
Enter the principal (amount), time(in Year), and rate::
10000
2
15
Simple Interest = 3000.00
Q 50 Write a Program in C language to Display student details using structure
#include
//#include
struct student {
char firstName[50];
int roll;
float marks;
} s[5];
int main() {
int i;
printf("Enter information of students:\n");
// storing information
for (i = 0; i < 3; ++i) {
s[i].roll = i + 1;
printf("\nFor roll number%d,\n", s[i].roll);
printf("Enter first name: ");
scanf("%s", s[i].firstName);
printf("Enter marks: ");
scanf("%f", &s[i].marks);
}
printf("Displaying Information:\n\n");
// displaying information
for (i = 0; i < 3; ++i) {
printf("\nRoll number: %d\n", i + 1);
printf("First name: ");
puts(s[i].firstName);
printf("Marks: %.1f", s[i].marks);
printf("\n");
}
return 0;
}
------------------------------
Output -
Enter information of students:
For roll number1,
Enter first name: TARA
Enter marks: 80
For roll number2,
Enter first name: VIBHUTI
Enter marks: 90
For roll number3,
Enter first name: BHUPENDRA
Enter marks: 110
Displaying Information:
Roll number: 1
First name: TARA
Marks: 80.0
Roll number: 2
First name: VIBHUTI
Marks: 90.0
Roll number: 3
First name: BHUPENDRA
Marks: 110.0
Precízna diagnostika s Balanset-1A: Základy vibračnej analýzy
Nečakané poruchy strojov predstavujú nielen finančné straty, ale aj riziko prestojov vo výrobe. Efektívnym riešením prevencie je pravidelná vibrodiagnostika, umožňujúca včasnú identifikáciu problémov a predchádzanie závažným poškodeniam. S Balanset-1A získavate presný a spoľahlivý nástroj na meranie a analýzu vibrácií, ktorý vám pomôže udržať vaše zariadenia v optimálnom stave.
Prečo je vibrodiagnostika dôležitá?
Vibrácie sú neoddeliteľnou súčasťou prevádzky rotujúcich strojov. Nadmerné alebo neobvyklé vibrácie však signalizujú potenciálne problémy, ako napríklad nevyváženosť rotorov, opotrebované ložiská, uvoľnené spoje či poškodené ozubené kolesá. Ignorovanie týchto signálov môže viesť k drahým opravám, prestojom vo výrobe a v krajných prípadoch aj k haváriám.
Vibračná analýza poskytuje detailné informácie o stave stroja a umožňuje identifikovať príčiny vibrácií. Vďaka včasnej diagnostike môžete plánovať preventívnu údržbu, minimalizovať prestoje a predĺžiť životnosť vašich zariadení.
Balanset-1A: Váš spoľahlivý partner pre vibrodiagnostiku
Balanset-1A je moderný prístroj na meranie a analýzu vibrácií, určený pre širokú škálu rotujúcich strojov. Ponúka presné meranie vibrácií v rôznych frekvenčných pásmach, čo umožňuje identifikovať aj skryté defekty. Jeho intuitívne ovládanie a prehľadný displej zjednodušujú proces merania a analýzy.
Vďaka Balanset-1A môžete:
Presne merať vibrácie vo všetkých troch osiach.
Identifikovať nevyváženosť rotorov.
Diagnostikovať opotrebenie ložísk.
Detekovať uvoľnené spoje a poškodené ozubené kolesá.
Monitorovať stav strojov v reálnom čase.
Plánovať preventívnu údržbu a optimalizovať prevádzkové náklady.
Výhody Balanset-1A:
Balanset-1A ponúka množstvo výhod oproti tradičným metódam diagnostiky:
Presnosť: Vysoká presnosť merania umožňuje včasnú identifikáciu aj menších defektov.
Spoľahlivosť: Robustná konštrukcia a kvalitné komponenty zaručujú spoľahlivú prevádzku aj v náročných podmienkach.
Jednoduchosť použitia: Intuitívne ovládanie a prehľadný displej zjednodušujú proces merania a analýzy.
Flexibilita: Balanset-1A je vhodný pre širokú škálu rotujúcich strojov.
Návratnosť investície: Vďaka včasnej diagnostike a prevencii porúch sa investícia do Balanset-1A rýchlo vráti.
Prevencia je kľúčom k úspechu
Investícia do vibrodiagnostiky s Balanset-1A predstavuje investíciu do dlhodobej prevádzkyschopnosti vašich zariadení. Pravidelné meranie a analýza vibrácií vám umožní predchádzať neplánovaným prestojom, minimalizovať náklady na opravy a maximalizovať produktivitu.
Získajte Balanset-1A a zabezpečte si bezproblémovú prevádzku vašich zariadení. Kontaktujte nás pre viac informácií a cenovú ponuku.
Zariadenie na analýzu vibrácií
супрастинекс инструкция по применению таблетки взрослым [url=https://allallergy.ru/]https://allallergy.ru/[/url] .
cDvoGn cNdotEG Flv wmIiv wamvCLXm fpjIi