Posts

Showing posts from December, 2021

if a five digit number is input through the keyboard write a program to calculate the sum of its digits.(Hints:Use the modulus operator %)

Image
if a five digit number is input through the keyboard write a program to calculate the sum of its digits.(Hints:Use the modulus operator %)  #include<stdio.h> int main() {   int numb er ,sum=0,i,n, count=0,num; printf(" Enter the number :"); scanf("%d" , &number);   num=number; while=(num!=0) { num/=10; count+=1; } for(i=0;i<count;i++) //i=0 to i=count-1(length(number)) { n=number%10; number=number/10; sum=sum+n; } printf("sum=%d",sum); return 0; } OUTPUT--   Enter the number:54678                              sum=30 OUTPUT--   another important program- - 1. paper of size A0 has dimensions 1189 mmx 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8. https://allcodescience.blogspot.com/2021/12/paper-of-size-a0-has-dimensions-1189.html  2... If lengths of three sid

consider A currency system in which there are notes of seven denominations namely Rs.1,Rs.2,Rs.5,Rs.10,Rs.50,Rs.100.If a sum of Rs. N is the entired through the keyboard ,Write a program to compute the smallest number of notes that will combine to give Rs.N.

Image
 consider  A currency system in which there are notes of seven denominations namely Rs.1,Rs.2,Rs.5,Rs.10,Rs.50,Rs.100.If a sum of Rs. N is the entered through the keyboard ,Write a program to compute the smallest number of notes  that will combine to give Rs.N program----  #include<stdio.h> int main () {  int amount,nohun,nofifty,noten,nofive, notwo,noone,total; printf("Enter the amount:"); scanf("%d",&amount); nohund=amount/100; amount=amount%100; nofifty=amount/50; amount=amount%50; noten=amount/50; amount=amount%10; nofive=amount/5; amount=amount%5; notwo=amount/2; amount=amount%2; noone=amount/1; amount=amount%1; total=nohund+nofifty+noten+nofive+notwo+noone: printf("Smallest number of notes=%d\n",total); return 0; }   OUTPUT --- Enter the amount: 4505   Smallest number of notes= 46      OUTPUT --- If a five digit number is input through the keyboard write a program to the reverse  the number-- click the link-- https://www.blogger.com/u/2/b

If a five digit number is input through the keyboard write a program to the reverse the number

Image
 If a five digit number is input through the keyboard write a program to the reverse  the number.  /* Reverse digits of a 5- digits number.*/ #include<stdio.h> int main() { int n ,d5,d4,d3,d2,d1; long int revnum; printf("\n Enter a five digit number (less than 32767):"); scanf("%d",&n); d5=n%10;                    //5th digit n=n/10;                            //remaining digits d4=n%10;                          //4th digits n=n/10;                         //remaining digit d3=n%10;                                      //3th digits n=n/10;                         //remaining digits d2=n%10;                                           //2th digits n=n/10;                                        //remaining digits d1=n%10;                                   //1th digits  revnum=d5*10000+d4*1000+d3*100+d2*10+d1; //specifier %Id is used for a printing a long integer printf("The reverse number is %1d\n",revnum); return 0 ; }  output--- Enter a five

If lengths of three sides of a tringle are input through the keyboard write a program to find the area of tringle.

Image
 If lengths of three sides of a triangle are input through the keyboard write a program to find the area of triangle. // Find the area of triangle  ,given the sides. #include <stdio.h> #include<math.h>                    //for sqrt() int main()  { float a,b,c,sp, area; printf("\nEnter sides of a triangle:"); scanf("%f%f%f",&a,&b,&c); sp =(a+b+c)/2; area=sqrt(sp*(sp-a)*(sp-b)*(sp-c)); printf("Area of triangle=%f\n",area); return 0; } output--- Enter sides of tringle: 4   5   6                    Area of triangle= 9.921567   paper of size A0 has dimensions 1189 mmx 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8.    https://www.blogger.com/u/2/blog/post/edit/5851128460296589847/8384434084948408766   The length and breadth of a rectangle and radius o

paper of size A0 has dimensions 1189 mmx 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8.

Image
 paper of size A0 has dimensions 1189 mm X 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8 #include<stdio.h> int main() { int i, w=841 ,h=1189 , t ; for(i=0;i<9;i++) printf("\nA%d:%d x %d",i,w,h); t=h; h=w; w=t/2; return 0; }  output---   A0 :841 x 1189                               A1 : 594 x 841                               A2 : 420 x 594                             A3 : 297 x 420                            A4 : 210 x 297                          A5 : 148 x 210                          A6 : 105 x 148                          A7 :  74 x 105                          A8 : 52 x 74 The length and breadth of a rectangle and radius of a circle are input through the keyboard. write a program to calculate the area and perimeter of the rectangle, and the area and circumference of the circle

the length and breadth of a rectangle and radius of a circle are input through the keyboard. write a program to calculate the area and perimeter of the rectangle, and the area and circumference of the circle

Image
The length and breadth of a rectangle and radius of a circle are input through the keyboard. write a program to calculate the area and perimeter of the rectangle, and the area and circumference of the circle  #include<stdio.h> # include<conio.h> int main(){ float l,b,r, ca,cc,ra ,rp; printf("Enter the length of rectangle:"); scanf("%f",&l); printf("Enter the breadth of rectangle:"); scanf("%f",&b); printf("Enter the radius of circle:"); scanf("%f",&r); ra=l*b; rp=2*(l+b); ca=3.14*r*r; cc=2*3.14*r; printf("\nThe area of rectangle :%0.2f", ra); printf("\n The perimeter of rectangle : %.2f ,rp); printf("\nThe  area of circle:%2f:",ca); printf("\n The circumference of circle:%.2f",cc); return 0; }  output- -- Enter the length of rectangle:3                            Enter the breadth of rectangle:5                            Enter the radius of circle:6                  

Temrature of a city in fahrenheit degrees in input through the keyboard. Write a program to convert this temprature into centigrade degrees.

Image
 Temprature of a city in fahrenheit degrees in input through the keyboard. Write a program to convert this temprature into centigrade degrees.   #include<stdio.h> #include<conio.h> int main() {  float f,c; printf("Enter the temprature in fahrenheit:"); scanf("%f",&f); c=(f-32)*5/9; printf("The temprature in centigrade degree:%.2f",c); return 0; } output-- Enter the temprature in fahrenheit : 98                  The temprature in centigrade degree: 36.67   output if the marks obtain by a student in five different subjects are input through the keyboard write a program to find out the aggregate marks and percentage marks obtained by the student. assume that the maximum marks that can be obtained by a student in each subject is 100. https://allcodescience.blogspot.com/2021/12/if-marks-obtain-by-student-in-five.html   1.The distance between two cities (in km).is input through the keyboard Write a program to convert to print the distance

if the marks obtain by a student in five different subjects are input through the keyboard write a program to find out the aggregate marks and percentage marks obtained by the student. assume that the maximum marks that can be obtained by a student in each subject is 100.

Image
 If the marks obtain by a student in five different subjects are input through the keyboard write a program to find out the  aggregate marks and percentage marks obtained by the student. assume that the maximum marks that can be obtained by a student in each  subject is 100-----  #include<stdio.h> int main(){ int m1,m2,m3,m4,m5,aggr; float per; printf("/nEnter the marks in 5 subjects:"); scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5); aggr=m1+m2+m3+m4+m5; per=aggr/5; printf("aggregate Marks=%d\n",aggr); printf("percentege Marks =%d\n",per); return 0; }  Output--- Enter the marks in 5 subjects:85 75 60 72 56 Aggregate Marks= 348 percentage Marks=69.00000  output----     1.The distance between two cities (in km).is input through the keyboard Write a program to convert to print the distance in meters feet,imches and centimeter. https://allcodescience.blogspot.com/2021/12/the-distance-between-two-cities-in-kmis.html 2.calculat

The distance between two cities (in km).is input through the keyboard Write a program to convert to print the distance in meters feet,imches and centimeter.

Image
  The distance between two cities (in km). is input through the keyboard Write a program to convert to print the distance in meters feet, inches and centimeter.   program-- \\conversion of distance #include<stdio.h> int main() { float km,m,cm,ft,inch; printf("\n Enter the distance in kilometer :"); scanf("%f",&km); m=km*1000; cm=m*100; inch=cm/2.54; ft=inch/12;   printf("Distance in meters=%f\n",m);   printf("Distance in centimeter=%f\n",cm); printf("Distance in feet=%f\n",ft);    printf("Distance in inches=%f\n",inch);    return 0; }  OUTPUTs --  Enter the distance in kilometers:4 Distance in meter=4000.00000 Distance in centimeter=400000.0000 Distance in feet=13123.359375 Distance in inches =157480.312500   1) calculate the simple interest  program click the link-- --- https://allcod escience.blogspot.com/2021/12/calculate-of-simple- interest.html  2 .Ramesh basic salary is input through the k eyword .His dear

calculate of simple interest

Image
 //calculate of simple interest #include<stdio.h> int main( ) {   int p,n; float r,si; printf("Enter value of p,n,r="); scanf(%d%d%f",&p,&n,&r); si=(p*n*r)/100; printf("%f\n",si); return 0; }  output--   Enter value of p,n,r=1200                                                                                                  n=3                                               r=12.5                                             450.00000                    Ramesh basic salary is input through the keyword .His dearness allowance is 40% of the basic salary and house rent allowance is 20% of basic salary write a program to calculate his gross salary.   https://allcodescience.blogspot.com/2021/12/ramesh-basic-salary-is-input-through.html   Discrete Mathematical Structure. Set Theory Functions Relations Propositional Logic Predicate Logic Group Theory https://allcodescience.blogspot.com/2021/12/discrete-mathematical-s

Ramesh basic salary is input through the keyword .His dearness allowance is 40% of the basic salary and house rent allowance is 20% of basic salary write a program to calculate his gross salary.

Image
  Ramesh basic salary is input through the keyword .His dearness allowance is 40% of the basic salary and house rent allowance is 20% of basic salary  write a program to calculate his gross salary.  //calculate Ramesh gross salary #include<stdio.h> int main(){     float bp,da ,hra, grpay;     printf("\n Enter the value basic salary of ramesh:");     scanf("%f",&bp);     da=0.4*bp;     hra =0.2*bp;     grpay=bp+da+hra;     printf("Basic salary of Ramesh=%f\n",bp);     printf("Dearness allowance=%f\n",da);     printf("House rent allowance=%f\n",hra);     printf("Gross pay of Ramesh is %f\n",grpay);     return 0; } output---Enter the value basic salary of ramesh:1200               basic salary of ramesh:1200.000                    Dearness allowance=480.0000                     house rent of allowance=240.00000                    gross pay of ramesh's is =1920.000      output ----- all about of c language(very si

How will learn of c language?

You can not be great at the start, but you  have to start to be great. So making a beginning is important . This chapter will help you wet your feet, before beginning a more arduous C journey...... well begun is half done. .. 1.what  is C? 2. Getting started with C? 3.All alphabets , Digits,and special symbols? 4. Rules for constructing integer constant? 5. Type of constant? 6 .Type of c variable? 7.Rules for constructing real constant? 8. Rules for constructing character constant? 9.Rules for constructing variable name? 10. C keywords? 11 .what is main()? 12 .what is printf () ? 13. The first C program? 1.what  is C language ?   ---C is a programming language developed at AT& T's Bell laboratories of USA in 1972 by dennis Ritchie .  C become popular because it is simple and easy to use. An opinion that is often heard today is "C has been already superseded by languages like C++,C# and java ,so why bother to learn C today" there are several reasons for this . there