The document contains code for three C programs:
1) A program to generate the first n terms of the Fibonacci sequence, where the sequence is defined as starting with 0, 1, and each subsequent term is the sum of the previous two terms.
2) A program that takes user input for a number n and prints all prime numbers between 1 and n by checking if each number is divisible by numbers between 1 and itself.
3) A program that takes a positive integer as input, calculates the sum of its individual digits by repeatedly taking the remainder and quotient of the number divided by 10, and prints the final sum.
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
These problems are so common that you will find in any C learning curriculum. Either in your college or in any IT institute.
I have provided solutions to these problems as well.
Happy learning...
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
1. /* A Fibonacci Sequence is defined as follows: the first and
second terms in the sequence are 0 and 1. Subsequent
terms are found by adding the preceding two terms in the
sequence. Write a C program to generate
the first n terms of the sequence.
*/
#include <stdio.h>
main()
{
int num1=0, num2=1,no,counter,fab;
printf("<===========PROGRAM TO FIND THE FIBONACCI SERIES UP TO N NO. IN
SERIES=========>");
printf("nnnttENTER LENGTH OF SERIES (N) : ");
scanf("%d",&no);
printf("nnttt<----FIBONACCI SERIES---->");
printf("nntt%d %d",num1,num2);
//LOOP WILL RUN FOR 2 TIME LESS IN SERIES AS THESE WAS PRINTED IN ADVANCE
for(counter = 1; counter <= no-2; counter++)
{
fab=num1 + num2;
printf(" %d",fab);
num1=num2;
2. num2=fab;
}
}
/* Write a C program to generate all the prime numbers
between 1 and n, where n is a value supplied by the user. */
#include <stdio.h>
main()
{
int no,counter,counter1,check;
printf("<-----------------------PRIME NO. SERIES------------------------>");
printf("nnntttINPUT THE VALUE OF N: ");
scanf("%d",&no);
printf("nnTHE PRIME NO. SERIES B/W 1 TO %d : nn",no);
for(counter = 1; counter <= no; counter++)
{
check = 0;
//THIS LOOP WILL CHECK A NO TO BE PRIME NO. OR NOT.
3. for(counter1 = counter-1; counter1 > 1 ; counter1--)
if(counter%counter1 == 0)
{
check++; // INCREMENT CHECK IF NO. IS NOT A PRIME NO.
break;
}
if(check == 0)
printf("%dt",counter);
}
}
/* Write a C program to find the sum of
individual digits of a positive integer.*/
#include<stdio.h>
main()
{
int num, k=1, sum=0;
printf("Enter the number whose digits are to be added:");
scanf("%d",&num);
while(num!=0)
{
4. k=num%10;
sum=sum+k;
k=num/10;
num=k;
}
printf("Sum of the digits:%d",sum);
}