C Program to compute sum and reverse of a given integer

/*WAP to compute sum and reverse of a given integer*/ #include<stdio.h> void main() { int sum=0,rev=0,rem,n; clrscr(); printf(“Enter The Integer-“); scanf(“%d”,&n); while(n!=0) { rem=n%10; sum=sum+rem; rev=rev*10+rem; n=n/10; } printf(“The Sum Of Digits Is =%d\n”,sum); printf(“Reversed Number Is =%d”,rev); getch(); } Output Enter The Integer-248 The Sum Of Digits Is =14 Reversed Number Is =842 Download … Read moreC Program to compute sum and reverse of a given integer

C Program to calculate roots of a quadratic equation using switch statement

/*WAP to calculate roots of a quadratic equation using switch statement*/ #include<stdio.h> #include<math.h> #include<stdlib.h> void main() { int option; float a,b,c,d,r1,r2; clrscr(); printf(“Enter The Coefficient Of A, B and C\n”);\ scanf(“%f%f%f”,&a,&b,&c); if(a==0) { printf(“Not A Quadratic Equation\n”); exit(0); } d=b*b-4*a*c; if(d==0) option=1; else if(d>0) option=2; else option=3; switch(option) { case 1:printf(“Roots Are Real and Equal … Read moreC Program to calculate roots of a quadratic equation using switch statement