Opening Ceremony
Bhim Higher Secondary School Suntopar, Dolakha
Opening Ceremony
Bhim Higher Secondary School Suntopar, Dolakha
JCT Students (First Batch(2069-2070))
Bhim Higher Secondary School Suntopar, Dolakha
Opening Ceremony
Bhim Higher Secondary School Suntopar, Dolakha
Opening Ceremony
Bhim Higher Secondary School Suntopar, Dolakha
Sunday, July 31, 2016
Program in C to find the factorial of a given number
#include<stdio.h>
#include<conio.h>
void main()
{
int i, num, fact = 1;
printf("\n Enter a number to calculate it's factorial : ");
scanf("%d", &num);
for (i = 1; i <= num; i++)
fact = fact * i;
printf(" Factorial of %d = %d\n", num, fact);
getch();
}
Program in C to find sum, difference and product of 2 numbers using switch case statement
/* Program in C to find sum, difference and product of 2 numbers using switch case statement */
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,ch;
printf("\n Enter First Number :");
scanf("%d",&a);
printf("\n Enter Second Number :");
scanf("%d",&b);
printf("\n Enter Your Choice: ( 1. Sum: 2. Difference : 3. Product: ) ");
scanf("%d",&ch);
switch (ch)
{
case 1:
{
printf("\n The sum = %d",a+b);
break;
}
case 2:
{
printf("\n The difference = %d",a-b);
break;
}
case 3:
{
printf("\n The Product = %d",a*b);
break;
}
default:
{
printf("\n out of range");
}
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,ch;
printf("\n Enter First Number :");
scanf("%d",&a);
printf("\n Enter Second Number :");
scanf("%d",&b);
printf("\n Enter Your Choice: ( 1. Sum: 2. Difference : 3. Product: ) ");
scanf("%d",&ch);
switch (ch)
{
case 1:
{
printf("\n The sum = %d",a+b);
break;
}
case 2:
{
printf("\n The difference = %d",a-b);
break;
}
case 3:
{
printf("\n The Product = %d",a*b);
break;
}
default:
{
printf("\n out of range");
}
}
getch();
}
Friday, July 29, 2016
Program in C to calculate wage according to given condition
8:11 AM
1 comment
/* A man is paid at the hourly rate of Rs 250 per hour for the first 30 hrs worked in a week.
There after the overtime is paid at 1.5 times the hourly rate for the next 25 hrs
and 2 times the hourly rate for further worked.
WAP to input the number of hours worked in a week and print the weekly wages */
/* Program to Enter 3 Numbers and Find the largest */
#include<stdio.h>
#include<conio.h>
void main()
{
int hour,wage;
printf("\n Enter The Worked Hours of week : ");
scanf("%d",&hour);
if(hour>0 && hour<=30)
{
wage=hour*250;
printf("\n Wages = %d ",wage);
}
else if(hour>30 && hour<=55)
{
wage=(hour*250*1.5);
printf("\n Wage = %d ",wage);
}
else if(hour>55)
{
wage=(hour*250*2);
printf("\n Wage = %d ",wage);
}
else{
printf("\Wrong Input, Try Again");
}
getch();
}
There after the overtime is paid at 1.5 times the hourly rate for the next 25 hrs
and 2 times the hourly rate for further worked.
WAP to input the number of hours worked in a week and print the weekly wages */
/* Program to Enter 3 Numbers and Find the largest */
#include<stdio.h>
#include<conio.h>
void main()
{
int hour,wage;
printf("\n Enter The Worked Hours of week : ");
scanf("%d",&hour);
if(hour>0 && hour<=30)
{
wage=hour*250;
printf("\n Wages = %d ",wage);
}
else if(hour>30 && hour<=55)
{
wage=(hour*250*1.5);
printf("\n Wage = %d ",wage);
}
else if(hour>55)
{
wage=(hour*250*2);
printf("\n Wage = %d ",wage);
}
else{
printf("\Wrong Input, Try Again");
}
getch();
}
Tuesday, July 26, 2016
Program in C For Series 2,5,10,17 ...... upto nth term and sum too
/* Program in C For Series 2 5 10 17 ...... upto nth term and sum too */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,calc=0,num=0,sum=0;
printf("\n Enter any number :");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
calc=i*i+1;
printf(" %d ",calc);
sum=sum+calc;
}
printf("\n Sum = %d :",sum);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,calc=0,num=0,sum=0;
printf("\n Enter any number :");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
calc=i*i+1;
printf(" %d ",calc);
sum=sum+calc;
}
printf("\n Sum = %d :",sum);
getch();
}
Friday, July 22, 2016
Subscribe to:
Posts (Atom)