Certified Cost Professional (CCP) Certification Study GuideFull description
Full description
ccp trainingFull description
Credit Corp Group
dandinddFull description
método novo para estudo de violino para a Congregação Cristã em PortugalDescrição completa
lab manualFull description
Antenna Wave PropagationFull description
program description
Descripción: lo
MANUAL PANIFICAÇÃO CCPDescrição completa
Exams4sure is one of the most excellent website where you can save extra money by getting 3 Months of free updates after purchasing the CCP exam questions dumps. If you have short time so, t…Full description
Exams4sure is one of the most excellent website where you can save extra money by getting 3 Months of free updates after purchasing the CCP exam questions dumps. If you have short time so, t…Full description
configurar cisco
This website is one of the most excellent website where you can save extra money by getting 3 Months of free updates after purchasing the CCP exam questions dumps. If you have short time so,…Full description
PART A Problem 1
Design, develop and execute a program in C to find and output all the roots of a given quadratic equation, for non-zero coefficients. Algorithm:
Step1: [Read co-efficients] Read a,b,c Step2: [Find Discriminant Value] Disc=b2 – 4ac If d>0 go to step 3 If d=0 go to step 4 Else go to step 5 Step3: [ Compute real and distinct roots] X1=(-b+sqrt(disc))/2a X2=(-b-sqrt(disc))/2a Print roots are real and distinct Print ‘Root1= ,Root2= ‘, X1,X2 Go to step 6 Step4: [Compute equal roots ] X1=X2=-b/2a Print roots are real and equal Print ‘Root1= ,Root2= ‘, X1,X2 Go to step 6 Step4: [Compute complex roots ] X1= -b/2a X2=(sqrt(abs(disc))/2a Print ‘Root1= ‘X1+IX2’ ,X1,X2 Print ‘Root1= ‘X1-IX2’ ,X1,X2 Go to step 6 Step 6: [End of algorithm] Stop
#include #include #include Void main() { float a,b,c,x1,x2,disc; clrscr(); printf("\n enter coefficients \n"); scanf("%f%f%f",&a,&b,&c); disc=b*b-4*a*c; if(disc>0) { x1=(-b+sqrt(disc))/(2*a); x2=(-b-sqrt(disc))/(2*a); printf("\n roots are real and distinct \n"); printf("x1=%f\n x2=%f\n",x1,x2); } else if(disc==0) { x1=x2=-b/(2*a); printf("\n roots are real and equal \n"); printf("\n x1=%f x2=%f\n",x1,x2); } else { x1=-b/(2*a); x2=sqrt(abs(disc))/(2*a); printf("\n roots are imaginary \n"); printf("\n first root=%f+i%f\n",x1,x2); printf("\n second root=%f-i%f",x1,x2); } getch(); }
OUTPUT: Enter the roots 144 The roots are equal X1=X2=-2.00000 Enter the roots 156 The roots are distinct X1=-2.000000 X2=-3.000000 Enter the roots 624 The roots are complex First roots=-0.166667+i0.799305
second root=-0.166667-i0.799305
Problem 2
Design, develop and execute a program in C to implement Euclid’s algorithm to find the GCD and LCM of two integers and to output the results along with the given integers.
Algorithm: Step1: [Read two numbers] Read m,n Step2: [Store the numbers in another] P=m Q=n Step3: [Looping] Repeat while n>0 R=m%n m=n n=r Step4: [Gcd and Lcm] Gcd=m Lcm=(p*q)/Gcd Print ‘gcd of m and n= ‘,gcd Print ‘lcm of m and n = ‘lcm Step 5: [ End of algorithm] Stop
#include #include void main() { int m, n, p, q, r, gcd, lcm; clrscr(); printf("Enter two numbers\n"); scanf("%d%d", &m, &n); p=m; q=n; while(n!=0) { r=m%n; m=n; n=r; } gcd=m; lcm=p*q/gcd; printf("GCD (%d, %d)=%d\n", p, q, gcd); printf("LCM (%d, %d)=%d\n", p, q, lcm); getch(); } OUTPUT: 1. Enter two numbers 24 GCD (2, 4)=2 LCM (2, 4)=4 2. Enter two numbers 6 16 GCD (6, 16)=2 LCM (6, 16)=48 3. Enter two numbers 9 27 GCD (9, 27)=9 LCM (9, 27)=27
Problem 3
Design, develop and execute a program in C to reverse a given four digit integer number and check whether it is a palindrome or not. Output the given number with suitable message. Algorithm: Step1: [Read the number to reverse] Read n Step2: [Initialize] Tvar=n Step3: [Looping] Repeat while n>0 rem=n%10 rev=rev*10+rem n=n/10 Step4: [Print reversed number] Print reverse of given number Step5:
[Compare orginal number and reversed number] If temp=rev then Print ‘num is palindrome ‘,temp Else Print ‘num is not palindrome ‘,temp Step 6: [End of algorithm] Stop
#include #include void main() { int n, m, rev, digit; clrscr(); printf("Enter the number\n"); scanf("%d", &n); m=n; rev=0; while(n!=0) { digit=n % 10; n=n / 10; rev=rev * 10 + digit; } if(m==rev) printf("Number is palindrome\n"); else printf("Number is not a palindrome\n"); getch(); } OUTPUT: 1. Enter the number 1351 Number is not a palindrome 2. Enter the number 1551 Number is palindrome 3. Enter the number 1221 Number is palindrome
Problem 4 Design, develop and execute a program in C to evaluate the given polynomial f(x) = a4x4 + a3x3 + a2x2 + a1x + a0 for given value of x and the coefficients using Horner’s method. Algorithm: Step1:[Read the value of n ] Read n Step2:[Enter Co-efficients] Repeat for i=0 to n in step 1 Read a[i] Step3:[Read the value of x] Read x Step4:[Initialize] sum =a[n]*x; Step5: [Evaluate polynomial] Repeat for i=n-1 down to 1 sum =(sum+a[i])*x; Step 6: [Finally add the first term] sum =sum+a[0] step 7:[Result] print the sum of polysum is ,sum Step 8: [End of algorithm] Stop
#include void main() { int n, i; float a[30], x, sum; printf("Enter the value of n\n"); scanf("%d", &n); printf("Enter n+1 values\n"); for(i=0; i<=n; i++) scanf("%f", &a[i]); printf("Enter the value for x\n"); scanf("%f", &x); sum=a[n]*x; for(i=n-1; i>0; i--) sum=(sum+a[i])*x; sum=sum+a[0]; printf("Evaluated result=%f\n", sum); } OUTPUT: 1. Enter the value of n 5 Enter n+1 values 11111 Enter the value for x 2 Evaluated result=63.000000 2. Enter the value of n 5 Enter n+1 values 54321 Enter the value for x 2 Evaluated result=120.000000
Problem 5 Design, develop and execute a program in C to copy its input to its output, replacing each string of one or more blanks by a single blank. #include #include int main() { char a; printf("Enter the string to copy into output\n"); a=getchar();
//loop terminate when newline encountered //to check is it space or tab //loop executes when continuous space
putchar(' ');
//printing single space
if(a=='\n') exit(0);
//if we reached the end terminate
} putchar(a); a=getchar(); } return 0; }
//read the next character //end of while loop //end of main
OUTPUT: 1. Enter the string to copy into output BANGALORE IS BIG Copied string is : BANGALORE IS BIG CITY 2. Enter the Enter the string to copy into output hi how are you Copied string is : hi how are you
CITY
Problem 6 Design, develop and execute a program in C to input N integer numbers in ascending order into a single dimension array, and then to perform a binary search for a given key integer number and report success or failure in the form of a suitable message.
Algorithm: Step1:[Read the limit value ] Read n Step2:[Read n elements] Repeat for i=0 to n in step 1 Read a[i] Step3:[Print entered elements] print entered elements of an array a[i] Step4:[Enter the elements to search] print 'enter the elements to search',key Step5: [Binary search technique] [Initialize] low=0 high=n-1 Step 6: [Looping] Repeat while low<=high Begin mid=(low+high)/2 if Key=a[mid] then print 'success', exit(0) end if if keya[mid] high=mid+1 end while step 7:[Result] print' key element not found in an array' Step 8: [End of algorithm] Stop