✔ C-LANGUAGE CHAPTERS:-
1. C-Introduction
2. C-Constants
3. C-Basic Programs
4. C-Instructors
5. C-Operators
6. C-If Else Statement
7. C-Loop Contructs
8. C-Nesting Of Loops
9. C-Programming Examples
10. C-Functions
11. C-Functions Naming Convention
12. C-Pointers
13. C-Arrays
14. C-Arrays & Functions
15. C-Strings
16. C-Structures
17. C-Union
18. C-Storage Classes
19. C-PreProcessor
20. C-Header Files
21. C-R/W one Line
22. C-Accessing Random File
23. C-Important Point
24. C-Interview Questions
1. C-Introduction
2. C-Constants
3. C-Basic Programs
4. C-Instructors
5. C-Operators
6. C-If Else Statement
7. C-Loop Contructs
8. C-Nesting Of Loops
9. C-Programming Examples
10. C-Functions
11. C-Functions Naming Convention
12. C-Pointers
13. C-Arrays
14. C-Arrays & Functions
15. C-Strings
16. C-Structures
17. C-Union
18. C-Storage Classes
19. C-PreProcessor
20. C-Header Files
21. C-R/W one Line
22. C-Accessing Random File
23. C-Important Point
24. C-Interview Questions
Quest1. Write a program to check whether an entered number is Even or Odd.
Solution: #include<stdio.h>
void main( )
{
int num;
printf(“Enter Number : ”);
scanf(“%d”, &num);
if(num % 2 = = 0)
printf(“Number is Even”);
else
printf(“Number is Odd”);
}
Output:
Quest2. Write a C program to check whether an entered number is Negative or Positive.
Solution: #include<stdio.h>
void main( )
{
int num;
printf(“Enter Number : ”);
scanf(“%d”, &num);
if(num >= 0)
printf(“Number is Positive”);
else
printf(“Number is Negative”);
}
Quest3. Write a C program to calculate circumference of a circle.
Solution:
#include<stdio.h>
void main( )
{
int r;
float area;
printf(“Enter Radius : ”);
scanf(“%d”, &r);
area = 2 * 3.14 * r;
printf(“Area is %f”, area);
}
Quest4. Write a program to find largest number among three inputted numbers.
Solution:
#include<stdio.h>
#include<conio.h>
void main( )
{
int num1, num2, num3;
clrscr();
printf(“Enter any 3 Numbers : ”);
scanf(“%d %d %d”, &num1, &num2, &num3);
if(num1 > num2)
{
if(num1 > num3)
{
printf(“%d is largest number”, num1);
}
else
{
printf(“%d is largest number”, num3);
}
}
else if(num2 > num3)
{
printf(“%d is largest number”, num2);
}
else
{
printf(“%d is largest number”, num3);
}
getch();
}
Output:
Ques5. Write a C program to display numbers from 1 to 100.
Solution:
#include<conio.h>
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
void main( )
{
int i;
for(i = 1; i <= 100; i++)
{
printf(“%d \n”, i);
}
getch();
}
Ques6. Write a program to display only Odd numbers between 1 to 50.
Solution: #include<stdio.h>
#include<conio.h>
void main( )
{
int i;
for(i = 1; i <= 50; i++)
{
if(i % 2 = = 1)
printf(“%d \n”, i);
}
getch();
}
Output:
Ques7. Write a C program to display count of digits of entered number using while loop.
Solution: #include<stdio.h>
#include<conio.h>
void main( )
{
int num, count = 0;
printf(“Enter a Number : ”);
scanf(“%d”, &num);
while(num)
{
count = count + 1;
num = num / 10;
}
printf(“Count of Digit is %d”, count);
getch();
}
Output:
Ques8. Write a program to whether an entered number is Prime or Not .
#include<conio.h>
Solution: #include<stdio.h>
#include<conio.h>
Solution: #include<stdio.h>
void main( )
{
int num, div = 2;
clrscr();
printf(“Enter a Number : ”);
scanf(“%d”, &num);
while(div < num)
{
if(num % div = = 0)
break;
div = div + 1;
}|
if(div = = num)
printf(“Number is Prime”);
else
printf(“Number is not Prime”);
getch();
}
Output: