CSCI TURBO C
NUMBER #1
#include
main(){
int n, sum = 0, square,i;
clrscr();
printf("Enter n: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
square=i*i;
sum+=square;
}
printf("Sum is: %d", sum);
getch();
}
NUMBER #2
#include
main()
{
int c,
a[2][12],
i,
x=0,
y=0;
clrscr();
printf("Input 12 numbers:\n");
for(i=0;i<12;i++){
scanf("%d", &c);
if(c %2==0)
a[0][x++]=c;
else
a[1][y++]=c;
}
printf("Odd numbers: ");
for(i=0;i
printf("%d ",a[1][i]);
getch();
}
NUMBER #3
#include
#include
#include
main()
{
int eoq,r,s,i;
clrscr();
printf("enter total yearly production requirement");
scanf("%d",&r);
printf("enter set up cost per order");
scanf("%d",&s);
printf("enter inventory carrying cost per unit");
scanf("%d",&i);
eoq=(2*r*s/i);
printf("the economic order quantity is %d",eoq);
getch();
}
NUMBER #4
#include
main(){
int i,j,a[5];
printf("enter the numbers");
for(i=1;i<=5;i++)
{
scanf("\n%d",&a[i]);
}
printf("what number to search:");
{
scanf("%d",&j);
}
if(j==a[i])
printf("FOUND IN LOCATION:%d",i);
getch();
}
#include
main(){
int n, sum = 0, square,i;
clrscr();
printf("Enter n: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
square=i*i;
sum+=square;
}
printf("Sum is: %d", sum);
getch();
}
NUMBER #2
#include
main()
{
int c,
a[2][12],
i,
x=0,
y=0;
clrscr();
printf("Input 12 numbers:\n");
for(i=0;i<12;i++){
scanf("%d", &c);
if(c %2==0)
a[0][x++]=c;
else
a[1][y++]=c;
}
printf("Odd numbers: ");
for(i=0;i
printf("%d ",a[1][i]);
getch();
}
NUMBER #3
#include
#include
#include
main()
{
int eoq,r,s,i;
clrscr();
printf("enter total yearly production requirement");
scanf("%d",&r);
printf("enter set up cost per order");
scanf("%d",&s);
printf("enter inventory carrying cost per unit");
scanf("%d",&i);
eoq=(2*r*s/i);
printf("the economic order quantity is %d",eoq);
getch();
}
NUMBER #4
#include
main(){
int i,j,a[5];
printf("enter the numbers");
for(i=1;i<=5;i++)
{
scanf("\n%d",&a[i]);
}
printf("what number to search:");
{
scanf("%d",&j);
}
if(j==a[i])
printf("FOUND IN LOCATION:%d",i);
getch();
}
Mga Komento
Mag-post ng isang Komento