/Prime factors for a number using c/ include include int main(){int num,i=1,j,k;//clrscr();printf(“\nEnter a number:”);/* enter a positive integer / scanf(“%d”,&num); while(i<=num) { k=0; if(num%i==0) // checks for factor { j=1; while(j<=i) { if(i%j==0) { k++; } j++; } if(k==2) / checks for prime factor */printf(“\n%d is a prime factor”,i);}i++;}getch();} OUTPUT for Prime Factors of a …
Start reading C Program to Find Prime Factors of a Given Positive NumberBlog
Bit stuffing is a process of inserting an extra bit as 0, once the frame sequence encountered 5 consecutive 1’s.z include include int main(){int a[20],b[30],i,j,k,count,n;printf(“Enter frame size (Example: 8):”);scanf(“%d”,&n);printf(“Enter the frame in the form of 0 and 1 :”);for(i=0; i<n; i++)scanf(“%d”,&a[i]);i=0;count=1;j=0;while(i<n){if(a[i]==1){b[j]=a[i];for(k=i+1; a[k]==1 && k<n && count<5; k++){j++;b[j]=a[k];count++;if(count==5){j++;b[j]=0;}i=k;}}else{b[j]=a[i];}i++;j++;}printf(“After Bit Stuffing :”);for(i=0; i<j; i++)printf(“%d”,b[i]);return 0;} OUTPUT for …
Start reading Bit Stuffing Program in CImplementation of Queue operations using c programming. The Queue is implemented without any functions and directly written with switch case. Easy code for Queue operations using c. int main(){int queue[n],ch=1,front=0,rear=0,i,j=1,x=n;printf(“Queue using Array”);printf(“\n1.Insertion \n2.Deletion \n3.Display \n4.Exit”);while(ch){printf(“\nEnter the Choice:”);scanf(“%d”,&ch);switch(ch){case 1:if(rear==x)printf(“\n Queue is Full”);else{printf(“\n Enter no %d:”,j++);scanf(“%d”,&queue[rear++]);}break;case 2:if(front==rear){printf(“\n Queue is empty”);}else{printf(“\n Deleted Element is %d”,queue[front++]);x++;}break;case 3:printf(“\nQueue Elements are:\n …
Start reading Implementation of Queue using Array in Cinclude include int main (){int n, count;printf (“enter a number to print table:”);scanf (“%d”, &n); count = 1; start:if (count <= 10){printf (“%d*%d=%d\n”, n, count, n * count);count++;goto start;} return 0;} OUTPUT: enter a number to print table:881=8 82=1683=24 84=3285=40 86=4887=56 88=6489=72 810=80
Start reading C Program for Multiplication Table using Goto StatementThe Circumference of a Circle can be calculated using the formulae 2*PI*r In the below c program, the PI value taken as 3.14. All the values dealing with Decimals, so float is a Datatype. int is not a right datatype, it will remove all the decimal parts of output. include int main (){ float radius, circumference; …
Start reading C Program for Circumference of a Circleinclude include int main (){ int first = 0, second = 1, third, i, n; printf (“Enter the length of the fibonacci series \n”); scanf (“%d”, &n); printf (“The Fibonacci series is :\n”); printf (“%d%d”, first, second); for (i = 2; i <= n; i++) return 0; } OUTPUT: Enter the length of the fibonacci …
Start reading C Program for Fibonacci Series Using for LoopC Program for printing the Pascal Triangle up to given number of rows. What is Pascal Triangle? In simple, Pascal Triangle is a Triangle form which, each number is the sum of immediate top row near by numbers. The Value of edge is always 1. include int main(){int rows, cal = 1, space, i, j; …
Start reading C Program to Print Pascal TraingleThe following program will print numbers as pyramid. The sequence will be printed as specified in the below triangle format. If user enter number of rows as 5 then following output will be produced. 0 1 0 1 2 1 0 1 2 …
Start reading C Program to Print Pyramid of NumbersWhat is FizzBuzz program? The program prints the numbers from 1 to n, where, for a given input number (n), for each integer i in the range from 1 to n 1. If i is a multiple of both 3 and 5 prints “FizzBuzz” instead of number2. If i is a multiple of 3 but not 5 prints …
Start reading Fizz Buzz Implementation in CThe program converts given number to individual digits and print words, the program only prints all the digits of a number in just equivalent words, but it is not a meaningful sentence. Example input: 456 325 -653 Example Output: Four Five Six Three Two Five please enter valid number The invalid numbers are any special …
Start reading C program to Convert Number to Words