0% found this document useful (0 votes)
2 views14 pages

Experiment - 1-Wps Office

The document contains multiple C programming examples, including simple programs for printing a name, performing basic arithmetic operations, calculating simple interest, and finding the area of a triangle. It also includes programs for storing student records, determining even or odd numbers from an array, and calculating different types of means for a set of numbers. Each program is accompanied by its respective code implementation.

Uploaded by

ranadhruv0309
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views14 pages

Experiment - 1-Wps Office

The document contains multiple C programming examples, including simple programs for printing a name, performing basic arithmetic operations, calculating simple interest, and finding the area of a triangle. It also includes programs for storing student records, determining even or odd numbers from an array, and calculating different types of means for a set of numbers. Each program is accompanied by its respective code implementation.

Uploaded by

ranadhruv0309
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

1).

#include<stdio.h>

#include<conio.h>

void main()

printf("Rana Dhruv");

getch();

}
2).write a program to that program as calculator (addition,subtraction, multiplication,

division).

#include<stdio.h>

#include<conio.h>

int main()

intx,y;

clrscr();

printf("Enter the value of x andy \n");

scanf ("%d%d",&x,&y);

printf("%d+%d %d\n",x,y,x+y);

printf("%d-%d=%d\n",x,y,x-y);

printf("%d %d %d\n",x,y,x*y);

printf("%d/%d=%d\n",x,y,x/y);

getch();

}
3).write a program to calculate simple interest(i=P*R*N/100).

#include <stdio.h>

#include <conio.h>

int main()

int p, r, n;

float i;

printf("Enter the principal amount: \n");

scanf("%d", &P);

printf("Enter the rate of interest: \n");

scanf("%d", &R);

printf("Enter the time period: \n");

scanf("%d", &N);

i = (P*R*N) / 100;

printf("Your total simple interest is: %.2f\n", i);

return 0;

}
4).write a program to find the area of triangle(a=h*b*0.5).

#include <stdio.h>

#include <conio.h>

int main()

int h, b;

float a;

printf("Enter the value of h: \n");

scanf("%d", &h);

printf("Enter the value of b: \n");

scanf("%d", &b);

a = 0.5 * h * b;

printf("Area of triangle is = %.2f", a);

getch();

}
1).Write a C program to read and store the roll no and marks of 20 students using array.

#include <stdio.h>

#include <conio.h>

int main()

int rollno[20], marks[20], i;

for (i = 0; i < 20; i++)

printf("Enter the roll number of student %d: ", i + 1);

scanf("%d", &rollno[i]);

printf("Enter the marks of student %d: ", i + 1);

scanf("%d", &marks[i]);

printf("\nStudent Records:\n");

for (i = 0; i < 20; i++) {

printf("\nRoll No: %d Marks: %d", rollno[i], marks[i]);

getch();

return 0;

}
2).Write a program to find out which number is even or odd from.

list of 1 0 numbers using array.

#include <stdio.h>

#include < conio.h >

int main()

int i, a[10];

for(i = 0; i < 10; i++)

printf("Enter the number: ");

scanf("%d", &a[i]);

for(i = 0; i < 10; i++)

if(a[i] % 2 == 0)

printf("%d is an even number\n", a[i]);

else
printf("%d is an odd number\n", a[i]);

return 0;

}
3).Write a C program to calculate the average, geometric and harmonic mean of
n elements in an array.

#include<stdio.h>

#include<math.h>

int main()

float a[50],s=0,s1=0,s2=1;

int i,n;

printf("\n Enter the number you want:");

scanf("%d",&n);

for(i=0;i<n;i++)

printf("\n Enter value at position[%d]:",i+i);

scanf("%f",&a[i]);

s=s+a[i];

s1=s1+(1.0/a[i]);

s2=s2*a[i];

printf("\naverage mean=%f", s/n);

printf("\ngeometric mean=%f",pow(s2,(1.0/n)));

printf("\n harmonic mean=%f",n*pow(s1,-1));

return 0;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy