allcprogrammingandalgorithm
allcprogrammingandalgorithm
All C programming & Algorithm
17 posts
Don't wanna be here? Send us removal request.
Text
An Electric power Distribution Company charges its consumers
An Electric power Distribution Company charges its consumers
Consumption Unit Rate of Charges For First 50 Units Rs 2.30 Next 50 Units Rs 2.60 Next 150 Units Rs 3.25 More than 250 Units Rs 4.35
Write a program to take no of units consumed from user and calculate the bill Amount.
#include int main() { int unit; float amt, total_amt, sur_charge; /* Input unit consumed from user */ printf("Enter total units consumed: "); scanf("%d",…
View On WordPress
0 notes
Text
A manufacturing company classified its executives into 4 levels for the benefit of certain perks. The levels and corresponding perks are shown below:
A manufacturing company classified its executives into 4 levels for the benefit of certain perks. The levels and corresponding perks are shown below:
table, th, td { border: 1px solid black; text-align:center; } Levels PerksConveyance AllowanceEntertainment Allowance110005002750200 350010042500
Income tax is deducted from the salary on a percentage basis as follows.  
table, th, td { border: 1px solid black; text-align:center; } Gross Salary Tax Rate Gross 5000 8%
View On WordPress
0 notes
Text
Write a program to read marks from keyboard and your program should display equivalent grade according to following table.
Write a program to read marks from keyboard and your program should display equivalent grade according to following table.
===================   
Marks     Grade
===================   
0‐34       Fail 
35‐59     Second Class   
60‐79     First Class   
80‐59     Dist
#include void main() { char name[50]; int roll_no,sub1,sub2,sub3,total; float avg; printf("\n\nEnter name of the student="); scanf("%s",name); printf("\n\nEnter roll number of the student="); scanf("%d",&roll_no); printf("\n\nEnter marks of…
View On WordPress
0 notes
Text
Write a program to check eligibility of student for admission. Student should fulfill the following criteria for admission :
Write a program to check eligibility of student for admission. Student should fulfill the following criteria for admission :
Mathematics >= 50
Physics >= 45
Chemistry >= 60
Total of all subject >= 170
OR
Total of Mathematics + Physics >= 120 Accept the marks of all the three subjects from the user and check if the student is eligible for admission. Print the message : Student is eligible for Admission OR Student is not eligible for…
View On WordPress
0 notes
Text
Write a program in C to calculate gross salary of employee using :
Write a program in C to calculate gross salary of employee using :
Gross Salary = Basic Pay + DA + HRA – PF.
DA = 30% If Basic Pay < 5000 otherwise DA = 45% of the Basic Pay.
HRA = 15% of Basic Pay.
PF = 12% of Basic Pay.
#include void main() { float gs,bp,DA,HRA,PF; printf("\n\nEnter basic pay="); scanf("%f",&bp); if (DA
View On WordPress
0 notes
Text
Write a program that read a number from 1 TO 7 and then print corresponding day name from the week using switch‐case.
Write a program that read a number from 1 TO 7 and then print corresponding day name from the week using switch‐case.
#include int main() { int week; printf("enter the week number(1-7)"); scanf("%d",&week); switch(week) { case 1: printf("monday"); break; case 2: printf("tuesday"); break; case 3: printf("wednesday"); break; case 4: printf("thusday"); break; case 5: printf("friday"); break; case 6: printf("saterday"); break; case 7: printf("sunday"); break; default: printf("invalid number"); } return 0; }
View On WordPress
0 notes
Text
Write a program in C to enter any arithmetic operator (+ ‐ * /) and two integer values and display result according to selection of operator.
Write a program in C to enter any arithmetic operator (+ ‐ * /) and two integer values and display result according to selection of operator.
#include void main() { char oper; int num1,num2,ans; printf("\nEnter Arithmetic operator===>" ); oper=getchar(); printf("\nEnter first value=" ); scanf("%d",&num1); printf("\nEnter second value=" ); scanf("%d",&num2); if(oper=='+') { ans=num1+num2; printf("\n\n\t ans is..%d\n\n",ans); } else if(oper=='-') { ans=num1-num2; printf("\n\n\t ans is..%d\n\n",ans); } else…
View On WordPress
0 notes
Text
Write a program to Find out given year which is leap or not.
Write a program to Find out given year which is leap or not.
#include void main() { int yr; printf("\nEnter year="); scanf("%d",&yr); if(yr%4==0) { if(yr%100==0) { if(yr%400==0) { printf("\n\n\t\t ** %d is Leap year **\n",yr); } else { printf("\n\n\t\t not Leap year. Century year..\n"); } } else{ printf("\n\n\t\t Leap year...\n"); } } else{ printf("\n\n\t\t Not a Leap year...\n"); } }
View On WordPress
0 notes
Text
Write a program to arrange any three numbers in ascending order.
Write a program to arrange any three numbers in ascending order.
#include void main() { int a,b,c; printf("\n\nEnter three numbers="); scanf("%d %d %d",&a,&b,&c); if (a
View On WordPress
0 notes
Text
Write a program to Check whether given number is positive, negative or zero.
Write a program to Check whether given number is positive, negative or zero.
#include<stdio.h> void main() { int num; printf("\nEnter number"); scanf("%d",&num); if(num>0) { printf("\nNumber is positive%d\n\n\n",num); } else if(num<0) { printf("\nNumber is negative%d\n\n\n",num); } else { printf("\nNumber is 0%d\n\n\n",num); } }
View On WordPress
0 notes
Text
Write a program to Find out Maximum number among two numbers.
Write a program to Find out Maximum number among two numbers.
#include<stdio.h> void main() { int num1,num2; printf("\nEnter first number"); scanf("%d",&num1); printf("\nEnter second number"); scanf("%d",&num2); if(num1>num2) { printf("\nMaximum number=%d",num1); } else { printf("\nMaximum number=%d\n\n\n",num2); } }
View On WordPress
0 notes
Text
Write a C program to read number and display in the form of Hour, Min and Seconds.
Write a C program to read number and display in the form of Hour, Min and Seconds.
#include<stdio.h> void main() { int num,hour,min,sec; printf("\nEnter any number="); scanf("%d",&num); hour=num/360; num=num%360; min=num/60; num=num%60; sec=num; printf("\nNumber of hour=%d",hour); printf("\nNumber of minute=%d",min); printf("\nNumber of seconds=%d\n\n\n",sec); }
View On WordPress
0 notes
Text
Write a C program to read a price of an item in (float) like 10.25 and print output in (int) paisa like1025.
Write a C program to read a price of an item in (float) like 10.25 and print output in (int) paisa like1025.
#include<stdio.h> void main() { float price; int paisa; printf("\nEnter price of an item="); scanf("%f",&price); paisa=price*100; printf("\nPrice of the item in paisa=%d\n\n\n",paisa); }
View On WordPress
0 notes
Text
Write a program to accept number of days and print year, month and remaining days.
Write a program to accept number of days and print year, month and remaining days.
#include<stdio.h> void main() { int days,year,month,rem; printf("\n\n\tenter the days...>"); scanf("%d",&days); year=days/365; days=days%365; month=days/30; rem=days%30; printf("\n\n\t no of year==>%d\n\n",year); printf("\n\n\t no of days==>%d\n\n",month); printf("\n\n\t no of rem==>%d\n\n",rem); }
View On WordPress
0 notes
Text
Write a C program to convert angle in degrees to radians using formula angle in radians = (angle in degrees * ∏) / 180.
Write a C program to convert angle in degrees to radians using formula angle in radians = (angle in degrees * ∏) / 180.
#include<stdio.h> void main() { float pi,rad; pi=3.14 printf("\n\n\tEnter is value::"); scanf("%f",&fval); ip=fval; rmd=ip%10; printf("\n right most of ::%d is rmd::%d\n\n",ip,rmd); }
View On WordPress
0 notes
Text
Write a C program to read the distance between two cities in KM. and print that distance in meters, feet, inches and centimeters.
Write a C program to read the distance between two cities in KM. and print that distance in meters, feet, inches and centimeters.
#include<stdio.h> void main() { float km, me, feet,inc,cm; printf("\n\n\tEnter is value::"); scanf("%f",&km); me=km*1000; cm=me*100; feet=cm*3780.5; inc=feet*12; printf("\n meters ::%f",me); printf("\n centimeter ::%f",cm); printf("\n feet ::%f",feet); printf("\n inches ::%f",inc); }
View On WordPress
0 notes
Link
#include<stdio.h> void main (){    printf("\n\n\t\t\t*******************************");    printf("\n\t\t\t*                               *");    printf("\n\t\t\t*         hello World           *");        printf("\n\t\t\t*                               *");    printf("\n\t\t\t*********************************\n");} output:- Hello World
1 note · View note