Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Showing posts with label C programming. Show all posts
Showing posts with label C programming. Show all posts

Sunday, April 11, 2010

Input total marks and display grade. Grade is calculated as follows.

 Input total marks and display grade. Grade is calculated as follows.

Total Marks Income Tax
>=360 First class
< 360 but >=270 Second class
< 270 but >=210 Pass class
<210 Fail


#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int tm;
printf("Enter Value of X");
scanf("%d", &tk);

if (tm >= 360)
  printf("Grade is First Class\n");
else
  if (tm >=270)
    printf("Grade is Second Class\n");
  else
      if (tm <= 210)
         printf("Grade is Pass Class");
      else
        printf("Grade is Fail\n");
getch( );
}


Dell Inspiron 545 i545-2062NBK Desktop PC with 21.5-Inch Flat Panel Monitor (Piano Black)Dell 3.0 Ghz. Super Fast GX Computer with Dell LCD Flat Monitor, Huge 500GB Hard Drive, 4GB RAM, DVD Burner (DVD-RW), and New Licensed Windows XP with Genuine Microsoft Authorized CDHP Pavilion Slimline S5220F Black Desktop PC (Windows 7 Home Premium)
read more "Input total marks and display grade. Grade is calculated as follows."

Input Basic Salary. Find and display Income Tax. Income Tax is calculated as follows:

Input Basic Salary. Find and display Income Tax. Income Tax is calculated as follows:

Basic Salary Income Tax
First 1000 Nil
Next 15 5%
Rest 10%



#include<stdio.h>
#include<conio.h>
void main( )
{
float bs, it;

clrscr( );
printf("Enter Basic Salary");
scanf("%f", &bs);
if (bs < 1000)
  it = 0;
else
  if (bs < 2500)
    it = (bs - 1000)*5/100;
  else
    it = 75 + (bs - 2500)*10/100;
printf("\n Income Tax is = %.2f\n", it);
getch( );
}

New Balance Men's MR993 Running ShoeSkechers Men's Shape Ups Lace-UpSkechers Women's Shape Ups - Strength Fitness Walking SneakerASICS Men's GT-2140 Running Shoe
read more "Input Basic Salary. Find and display Income Tax. Income Tax is calculated as follows:"

Input sales. Find and print commission. Commission is calculated as follows:

 Turquoise Zebra Stripe Wrist Watch
Input sales. Find and print commission. Commission is calculated as follows:
SALES Commission
<=10000 1%
>10000 but <=30000 5%
Rest 10%


#include<stdio.h>
#include<conio.h>
void main( )
{
float s, c;

clrscr( );
printf("Enter Sales");
scanf("%f", &s);
if (s<10000)
  c=s*1/100;
else
  if(s < 30000)
    c=s*5/100;
else
    c=s*10/100;
printf("/n Commission is =%.2f", c);
getch( );
}

White Ceramic Style Watch with Matching Strap and Face and Sparkly Clear RhinestonesCasio Men's Sea Analog Illuminator Dual LED Dive Watch #MDV102-1AVInvicta Men's Pro Diver Stainless Steel Silver Dial Watch #5249STimex Kids' Camouflage Stretch Band Watch #T78141Skagen Women's Silver Dial Mesh Bracelet Watch #358SSSD
read more "Input sales. Find and print commission. Commission is calculated as follows:"

Sunday, April 4, 2010

To input an integer and print whether it is a prime number or not.

Dell D600 Laptop 1.6ghz 40gb DVD/CDRW B Grade Includes Genuine XP Professional restore cd!Write a program in C to input any positive integer and to print whether it is a prime number or not.
Toshiba Satellite L505-GS5037 TruBrite 15.6-Inch Laptop (Black)

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int i, m, nd;

nd=0;
printf("Enter a positive integer\n");
scanf("%d", &m);
for(i=1; i<=m; i++)
{
if(m % i = = 0)
nd++;
}
if(nd ==2)
printf("%d is a prime number\n", m);
else
printf("%d is not a prime number\n",m);

}

M810 Watch Phone with 2 Stylus Pens
read more "To input an integer and print whether it is a prime number or not."

To find and print the standard deviation.

Write a program in C to input 12 numbers and then calculate, print the standard deviation of these numbers.
H&R Block At Home 2009 Deluxe Federal + State + eFile [Formerly TaxCut] [Download]

#include<stdio.h>
#include<conio.h>
#include<math.h>
#define N 12

void main( )
{
float x, sx, sxx, sd, a;
sx = sxx = 0;
for (a=1; a<=N; a++)
{
printf("Enter value of x");
scanf("%f", &x);
sx = sx + x;
sxx = sxx + x * x;
}
sd = sqrt(sxx / N - (sx/N) * (sx/N));
printf("Standard Deviation is %.2f\n", sd);
}

Super Mario Galaxy 2
read more "To find and print the standard deviation."

To find and print Karl pearson's correlation coefficient.

Walk A Mile In My ShoesWrite a program in C to input 10 pairs of x and y values and then print Karl pearson's correlation coefficient.
It Didn't Make A Sound [+Video]
Need You Now
The Story So Far

#include<stdio.h>
#include<conio.h>
#include<math.h>
#define N 10

void main( )
{
int i;
float x, y, sx=0, sy=0, sxx=0, syy=0, sxy=0, a, b, c, r;
for(i=0; i
{
printf("Enter values for x & y");
scanf("%f %f", &x, &y);
sx = sx + x;
sy = sy + y;
sxx = sxx + x * x;
syy = syy + y * y;
sxy = sxy + x * y;
}
a = sxy-sx*sy/N;
b = sqrt(sxx-sx*sx/N);
c = sqrt(syy-sy*sy/N);
r = a / (b*c);
printf("Coefficient of correlation is %f\n", r);


}

read more "To find and print Karl pearson's correlation coefficient."

To find and print the regression coefficient.

The Twilight Saga: New Moon (Two-Disc Special Edition)
Write a program in C to input 25 pair of x & y and calculate and print the regression coefficient (b).


#include<stdio.h>
#include<conio.h>
#include<math.h>

#define N 25
void main( )
{
int i, x, y;
float sx=0, sy=0, sxy=0, syy=0, a, b, c;
clrscr( );
for(i=1; i<=N; i++)
{
printf("Input values of x & y pairwise\n");
scanf("%d %d", &x, &y);
sx = sx + x;
sy = sy + y;
sxy = sxy + x * y;
syy = syy + y * y;
}
a = N*sxy - sx*sy;
c = N*syy - sy*sy;
b = a/c;
printf("\n The regression coefficient is %f\n", b);
}
read more "To find and print the regression coefficient."

To find and print Correlation of coefficient.

The Blind SideWrite a program in C to input 5 integer values of x & y and to calculate and print the coefficient of correlation between x & y.



#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int x, y, i;

float sx=0, sy=0, sxx=0, syy=0, sxy=0, a, b, c, r;
clrscr( );
for(i=1; i<=5; i++)
{
printf("Input values of x and y pairwise\n");
scanf("%d %d", &x, &y);
sx = sx + x;
sy = sy + y;
sxx = sxx + x * x;
syy = syy + y * y;
}
a = sxy - (sx * sy) / 5;
b = sqrt(sxx - (sx * sx) / 5 );
c = sqrt(syy - (sy * sy) / 5 );
r = a / (b *c);
printf("The correlation coefficient = %f\n", r);

}
read more "To find and print Correlation of coefficient."

Saturday, April 3, 2010

To find and print mean and mean deviation.

The Big Short: Inside the Doomsday Machinewrite a program in C to input 15 observations and then find and print mean and mean deviation from mean where, mean = SX/15 and mean deviation from mean = S |X-mean| / 15.



#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int a, x[15];

float tot=0, mdt=0, d, m, md;
printf("Input 15 values of x, one at a time\n");
for(a=0; a<15; a++)
{
scanf("%d", &x[a]);
tot = tot+x[a];
}
m = tot / 15;
for(a=0; a<15; a++)
{
d = x[a] - m;
if (d < 0 )
d = -d;
mdt = mdt + d;

}
md = mdt / 15;
printf("\n Mean = %f\n", m);
printf("Mean deviation = %f\n", md);
}

The Big Short: Inside the Doomsday Machine
read more "To find and print mean and mean deviation."

To find and print mean

Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)Input 10 integers values of x and calculate and print its mean(m).

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int i, x[10];

float s1=0, m;
clrscr( );
printf("Input 10 values of x, one at a time\n");
for(i=1; i<=10; i++)
{
scanf("%d", &x[i]);
s1 = s1+x[i];
}
m = s1/10;
printf("\n The mean is %f\n", m);
}
Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)
read more "To find and print mean"

To find and print mean and standard deviation.

Write a program in C to input 5 integer values (x) and to find and print their mean (m) and standard deviation (sd).

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int i, x[5];
float s1=0, s2=0, d, m, sd;
clrscr( );
printf("Input 5 values of x, one at a time\n");
for(i=1; i<=5; i++)

{
scanf("%d", &x[i]); 
s1 = s1+x[i]; 

m = s1/5;
for(i=1; i<=5; i++)
{
d = s[i] - m;
s2 = s2+d*d;
}
sd = sqrt(s2/5);
printf("\n The mean is %f\n", m);
printf("The standard deviation is %f\n", sd);
}
read more "To find and print mean and standard deviation."

Thursday, March 11, 2010

Find highest, median and lowest number from the given set of 17 numbers.

The Big Short: Inside the Doomsday Machine
Write a program in C to input 17 observation and then print highest, median and lowest.
#include<stdio.h>
#define N 17
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++) scanf("%d", &n[i]); for(i=0; i < N-1; i++) for (j=i+1; j < N; j++) if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("Highest number is %d", n[16]);
printf("Median is %d\n", n[8]);
printf("Lowest number is %d", n[0]);
getch( );
}
read more "Find highest, median and lowest number from the given set of 17 numbers."

Find the highest and lowest number from the given set of 13 numbers.

Write a program in C to input 13 observation and then print Highest and Lowest.


#include<stdio.h>
#define N 13
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("Highest number is %d", n[12]);
printf("Lowest number is %d", n[0]);
getch( );
}
read more "Find the highest and lowest number from the given set of 13 numbers."

Input 10 numbers. Find the lowest number from the given set of 10 numbers.

Write a program in C to input 10 observation and then print Lowest.


#include<stdio.h>
#define N 10
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("Lowest number is %d", n[0]);
getch( );
}

read more "Input 10 numbers. Find the lowest number from the given set of 10 numbers."

Input 25 numbers. Find the largest number from the given set of 25 numbers.

Write a program in C to input 25 observation and then print Highest.


#include<stdio.h>
#define N 25
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("Highest number is %d", n[24]);
getch( );
}
read more "Input 25 numbers. Find the largest number from the given set of 25 numbers."

Input 15 numbers. Arrange the numbers in ascending order and display the median of the same.

Write a program in C to accept 15 numbers, arrange these numbers in ascending order, display the median of the same.


#include< stdio.h>
#define N 15
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("Median is %d\n", n[7]);
getch( );
}
read more "Input 15 numbers. Arrange the numbers in ascending order and display the median of the same."

Input 20 numbers. Arrange the numbers in ascending order and display ascending order as well as descending order list.

Write a program in C to input 20 integers and then print these integers in ascending order of magnitude and then in descending order of magnitude.


#include<stdio.h>
#define N 20
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("The ascending order is \n");
for (i=0; i < N; i++)
printf("%d\t", n[i]);
printf("The descending order is \n");
for (i=N-1; i > = 0; i--)
printf("%d", n[i]);
getch( );
}
read more "Input 20 numbers. Arrange the numbers in ascending order and display ascending order as well as descending order list."

Input 20 numbers. Arrange the numbers in descending order and display descending order. (Sorting of an array)

Write a program in C accept 20 integers and arrange them in the descending order of values.(Sorting of an array)


#include<stdio.h>
#define N 20
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] < n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("The descending order is \n");
for (i=0; i < N; i++)
printf("%d\t", n[i]);
getch( );
}
read more "Input 20 numbers. Arrange the numbers in descending order and display descending order. (Sorting of an array)"

Input 10 numbers. Arrange the numbers in ascending order and display ascending order. (Sorting of an array)

Write a program in C accept 10 integers and arrange them in the ascending order of values.(Sorting of an array)


#include<stdio.h>
#define N 10
void main( )
{
int i, j, n[N], t;
printf("Enter %d integer values\n", N);
for (i=0; i < N; i++)
scanf("%d", &n[i]);
for(i=0; i < N-1; i++)
for (j=i+1; j < N; j++)
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j];
n[j] = t;
}
printf("The ascending order is \n");
for (i=0; i < N; i++)
printf("%d\t", n[i]);
}
read more "Input 10 numbers. Arrange the numbers in ascending order and display ascending order. (Sorting of an array)"

Wednesday, March 10, 2010

Calculation of depreciation , by using Written Down Value ( WDV ) as well as Straight Line Method ( SLM ).

Enter cost, rate of depreciation and number of years. Display depreciation for each year by WDV method as well as by Straight Line Method.


#include<stdio.h>
#include<conio.h>
void main( )
{
float cost, rate, year, slmdep, wdvdep, cnt;
clrscr( );
printf("Enter Cost, Dep.Rate, Years");
scanf("%f %f %f", &cost, &rate, &year);
slmdep = cost*rate/100;
for (cnt=1; cnt < = year; cnt++)
{
wdvdep = cost*rate/100;
cost = cost - wdvdep;
printf("\n Year %f, WDV Dep %.2f, SLM Dep %.2f\n", cnt, wdvdep,slmdep);
}
getch( );
}


read more "Calculation of depreciation , by using Written Down Value ( WDV ) as well as Straight Line Method ( SLM )."

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP