Join Regular Classroom : Visit ClassroomTech

c coding questions

ASCII Values in C

ASCII values in C: ASCII stands for American Standard Code for Information Interchange. This is a character encoding scheme used in electronics communication. Each ASCII code requires 7 bits in memory. The ASCII table is given bellow : Example : C C #include<stdio.h> int main() { char a; printf(“Enter a character : “); scanf(“%c”,&ch); printf(“n

ASCII Values in C Read More »

clrscr() command in C

clrscr() : clrscr() function is a pre-defined function in the header file conio.h(console input output). It is used to clear the data from the console screen. This function only works in “Turbo c++” compiler only. Using of clrscr() function in C is always optional but it should be place after variable or function declaration only.

clrscr() command in C Read More »

Format Specifier in C

Format specifier in C : The Format specifier is a string used in the formatted input and output functions. With the help of format specifiers the compiler understand that what is the data type of the variable while taking input through scanf() function and printing the output through printf() function. The format string always starts

Format Specifier in C Read More »

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 »