Join Regular Classroom : Visit ClassroomTech

Month: September 2020

Coding Question 15

Write a C program to check a number  is prime or not. #include<stdio.h> int main() { int num,x,fl=0; printf("n Enter the a Number: "); scanf("%d",&num); for(x=2;x<num;x++) { if(num%x==0) { fl=1; break; } } if(fl==0) printf("n %d is Prime No.",x); else printf("n %d is not Prime No.",x); } Join Our Telegram Group Visit our Facebook Page …

Coding Question 15 Read More »

Coding Question 14

Write a program to print sum of three digits prime numbers. #include<stdio.h> int prime(int i) { int x,fl=0; for(x=2;x<i;x++) { if(i%x==0) { fl=1; break; } } if(fl==0) { printf("n %d",i); return i; } else return 0; } int main() { int i,sum=0; for(i=100;i<1000;i++) { sum=sum+prime(i); } printf("n Sum of 3 digit Prime nos=%d",sum); return 0; …

Coding Question 14 Read More »

Coding Question 13

Write a program to compute  e= 1+ 1/1! + 1/2! + 1/3! ….1/n! with accuracy of 0.001%. #include<stdio.h> int fact(int i) { int fact=1,x; for(x=1;x<=i;x++) { fact=fact*x; } return fact; } int main() { int r,i,x; float sum=0.0; printf("n Enter the range: "); scanf("%d",&r); for(i=0;i<=r;i++) { x=fact(i); sum=sum + ((float)1/(float)x); } printf("n Result=%.4f",sum); return 0; …

Coding Question 13 Read More »

Program to accept a number and find sum of its individual digits repeatedly till the result is a single digit – Coding Question 12

Write a program to accept a number and find sum of its individual digits repeatedly till the result is a single digit. #include<stdio.h> int digit_sum(int sum) { int temp,r,s=0; temp=sum; while(temp!=0) { r=temp%10; s+=r; temp=temp/10; } return s; } int main() { int num,sum; printf("n Enter a number: "); scanf("%d",&num); sum=digit_sum(num); while(sum%10!=sum) { sum=digit_sum(sum); } …

Program to accept a number and find sum of its individual digits repeatedly till the result is a single digit – Coding Question 12 Read More »

Program to check a number is palindrome or not – Coding Question 10

Write a program to check a number is palindrome or not.  #include<stdio.h> int main() { int num,temp,sum=0,r; printf("n Enter a number: "); scanf("%d",&num); temp=num; while(num!=0) { r=num%10; sum=sum*10+r; num=num/10; } printf("n Reverse No. of %d= %d",temp,sum); if(sum==temp) printf("n %d is a pallindrome no.",temp); else printf("n %d is not a pallindrome no.",temp); return 0; } Join …

Program to check a number is palindrome or not – Coding Question 10 Read More »

Program to find the sum of the digits of a number – Coding Question 9

Write a program to find the sum of the digits of a number. #include<stdio.h> int main() { int num,temp,sum=0,r; printf("n Enter a number: "); scanf("%d",&num); temp=num; while(num!=0) { r=num%10; sum+=r; num=num/10; } printf("n Sum of Digits of %d= %d",temp,sum); return 0; } Join Our Telegram Group Visit our Facebook Page Coding Questions Coding Question :  …

Program to find the sum of the digits of a number – Coding Question 9 Read More »

Program in C to find the roots of a quadratic equation – Coding Question 7

Write a program in C to find the roots of a quardratic equation. Your program should print the imaginary roots in the form a+ib. #include<stdio.h> #include<math.h> int main() { int a,b,c; float x,root1,root2,real,img; printf("n Enter the value of a: "); scanf("%d",&a); printf("n Enter the value of b: "); scanf("%d",&b); printf("n Enter the value of c: …

Program in C to find the roots of a quadratic equation – Coding Question 7 Read More »

program to generates all combinations of 1,2 and 3 using for loop – Coding Question 6

Write a program to generates all combinations of 1,2 and 3 using for loop. #include<stdio.h> int main() { int i,j,k,z=1; printf("n All the combinations are as follows: "); for(i=1;i<=3;i++) for(j=1;j<=3;j++) for(k=1;k<=3;k++) printf("n%02d. %d %d %d",z++,i,j,k); return 0; } Join Our Telegram Group Visit our Facebook Page Coding Questions Coding Question :  Write a complete C …

program to generates all combinations of 1,2 and 3 using for loop – Coding Question 6 Read More »