SlideShare a Scribd company logo
Md. Najmul Hassan
ID: 171-15-1399
Sec: PC-G
Declare a variable named num and assign the
value 100 to this variable. Display “The value is
100”
int main()
{
int num;
num = 100;
printf("The value is %dn", num);
return 0;
}
Write a C program that will take an integer, a float
and a character from keyboard and also display
these inputs.
#include <stdio.h>
int main()
{
int a;
float b;
char ch;
printf("Enter the Character:....n");
scanf("%c", &ch);
printf("Enter the Integer:....n");
scanf("%d", &a);
printf("Enter the float:....n");
scanf("%llf", &b);
printf("nCharacter = %cn", ch);
printf("Integer = %dn", a);
printf("Float = %llfn", b);
}
Write a C program that will take two numbers
and display the Average of these numbers
#include <stdio.h>
int main()
{
double a, b, ave;
printf("Enter the two numbers for find their average:....n");
scanf("%lf %lf", &a, &b);
ave = ((a+b)/2.0);
printf("Average is %.1lfn", ave);
return 0;
}
Write a C program to convert Celsius to
Fahrenheit. [Formula is: F= (9C/5) + 32].
#include <stdio.h>
int main()
{
float celsius, fahrenheit;
printf("Enter temperature in Celsius: ");
scanf("%f", &celsius);
fahrenheit = ((celsius * 9)/5) + 32;
printf("n%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
return 0;
}
Write a program that will display the area of a
rectangle. Take two inputs for length and width of
the rectangle from the keyboard.
#include <stdio.h>
int main()
{
double a, b, c;
printf("Enter the length and width:...n");
scanf("%lf %lf", &a, &b);
c = a*b;
printf("The rectangle is %.1lfn", c);
return 0;
}
Write a program that will display the area of a
Triangle. Take two inputs for base and height of
the Triangle from the keyboard
#include <stdio.h>
int main()
{
double a, b, c;
printf("Enter the base and height for find the area of triangle:......n");
scanf("%lf %lf", &a, &b);
c = 0.5 * a * b;
printf("The area of triangle is %.lfn", c);
return 0;
}
Write a program that computes the number
of seconds in a year
#include <stdio.h>
int main()
{
int a, b;
printf("Enter the number:....n");
scanf("%d", &a);
b = a / 365;
printf("%d yearn", b);
return 0;
}
Swapping of two numbers using C
#include <stdio.h>
int main()
{
int a, b, c=0;
printf("Enter two number:....n");
scanf("%d %d", &a, &b);
c=a;
a=b;
b=c;
printf("The numbers are %d and %dn", a, b);
return 0;
}
Write a C program that will take two numbers, first
one for a number, second one for the power and
display the power value of that number.
#include <stdio.h>
int main()
{
int base, power;
long long total = 1;
int i;
printf("Enter base: ");
scanf("%d", &base);
printf("Enter power: ");
scanf("%d", &power);
for(i=1; i<=power; i++)
{
total = total * base;
}
printf("n%d ^ %d = %lld", base, power,
total);
return 0;
}
Write a C program that will take a number and
displays the square root of number.
#include <stdio.h>
#include <math.h>
int main()
{
double num, result;
printf("Enter the number:....n");
scanf("%lf", &num);
result = sqrt(num);
printf("%lf number square root is %.1lfn", num, result);
return 0;
}
Write a C program that displays from 1 to
100.
#include <stdio.h>
int main()
{
int i;
for(i=1; i<=100; i++)
{
printf("%d, ", i);
}
return 0;
}
Write a C program that displays from 100 to 1.
#include <stdio.h>
int main()
{
int i;
for(i=100; i>=1; i--)
{
printf("%d ,", i);
}
return 0;
}
Write a C program that displays the even/odd
number from 1 to 100.
#include <stdio.h>
int main()
{
int odd, even, i;
for(i=100; i>=1; i--)
{
if(i%2==0)
{
printf("%d is a even numbern", i);
}
else
{
printf("%d is a odd numbern", i);
}
}
return 0;
}
Write a C program that will take an integer
number and display it “EVEN” or “ODD”.
#include <stdio.h>
int main()
{
int num, even, odd;
printf("Enter the number:...n");
scanf("%d", &num);
if(num % 2 ==0 )
{
printf("%d number is a even
numbern", num);
}
else
{
printf("%d number is a odd numbern",
num);
}
return 0;
}
Write a C program that will take a year. If its leap
year then display “YES” or otherwise “NO”.
#include <stdio.h>
int main()
{
int year;
printf("Enter year : ");
scanf("%d", &year);
if(((year%4 == 0) && (year%100 !=0))
|| (year%400==0))
{
printf("YESn");
}
else
{
printf("NOn");
}
return 0;
}
Write a C program that will take an integer
number and display “POSITIVE” or “NEGATIVE".
#include <stdio.h>
int main()
{
int num;
printf("Enter the number:....n");
scanf("%d", &num);
if(num>0)
{
printf("POSITIVEn");
}
else
{
printf("NEGATIVEn");
}
return 0;
}
Write a C program that will take three integer
numbers and display the small number.
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter the numbers:.....n");
scanf("%d %d %d", &a, &b, &c);
if(a<b)
{
if(a<c)
{
printf("%d is the small numbern", a);
}
else
{
printf("%d is the small numbern", c);
}
}
else if(b<a)
{
if(b<c)
{
printf("%d is the small numbern", b);
}
else
{
printf("%d is the small numbern", c);
}
}
return 0;
}
Write a C program that will take three integer
numbers and display the middle number
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter the numbers:....n");
scanf("%d %d %d", &a, &b, &c);
if(a>b)
{
if(a<c)
{
printf("%d is the middle
numbern", a);
}
else
{
printf("%d is the middle
numbern", c);
}
}
else if(b>a)
{
if(b<c)
{
printf("%d is the middle
numbern", b);
}
else
{
printf("%d is the middle
numbern", c);
}
}
return 0;
}
Write a C program that will take three integer
numbers and display the large number.
#include <stdio.h>
int main()
{
int a, b, c;
printf("Enter the numbers:....n");
scanf("%d %d %d", &a, &b, &c);
if(a>b)
{
if(a>c)
{
printf("%d is the large numbern",
a);
}
else
{
printf("%d is the large numbern",
c);
}
}
else if(b>a)
{
if(b>c)
{
printf("%d is the large numbern",
b);
}
else
{
printf("%d is the large numbern",
c);
}
}
return 0;
}
Write a C program that will take an age and if age less than 10 then display Minor. If
the age between 11 to 19 then display “Teen”, If the age between 20 to 39 then
display “Young”, If the age between 40 to 49 then display “Adult” otherwise “Old”.
#include <stdio.h>
int main()
{
int a;
printf("Enter the
age:.....n");
scanf("%d", &a);
if(a<10)
{
printf("Minorn");
}
else if(a>=11 && a<=19)
{
printf("Teenn");
}
else if(a>=20 && a<=39)
{
printf("Youngn");
}
else if(a>=40 && a<=49)
{
printf("Adultn");
}
else
{
printf("Oldn");
}
return 0;
}
Write a C program that will take a number and if the number is less than 40 then display “Fail”. If the
number is between 40 to 49 then display “D”, if the number is between 50 to 59 then display “C”. If
the number is between 60 to 69 then display “B”, if the number is between 70 to 79 then display “A”,
if the number is between 80 to 100 then display “A+”
#include <stdio.h>
int main()
{
int a;
printf("Enter the
numbern");
scanf("%d", &a);
if(a>=40 && a<=49)
{
printf("Dn");
}
else if(a>=50 && a<=59)
{
printf("Cn");
}
else if(a>=60 && a<=69)
{
printf("Bn");
}
else if(a>=70 && a<=79)
{
printf("An");
}
else if(a>=80 && a<=100)
{
printf("A+n");
}
else{
printf("Failn");
}
return 0;
}
Thank You
Sir I am sorry that I couldn’t able to do rest the C
program. If you can solve those in our class it will
be great help to us.

More Related Content

What's hot

Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
Mainak Sasmal
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
University of Potsdam
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
Prasadu Peddi
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
Kuntal Bhowmick
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
PRATHAMESH DESHPANDE
 
program in c
program in cprogram in c
program in c
Tanmay337011
 
C programs
C programsC programs
C programsMinu S
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
Rahul Pandit
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
Leandro Schenone
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
Hazrat Bilal
 
The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robin
Abdullah Al Naser
 
C faq pdf
C faq pdfC faq pdf
C faq pdf
DebiPanda
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DR B.Surendiran .
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
Dr. Loganathan R
 
Examples sandhiya class'
Examples sandhiya class'Examples sandhiya class'
Examples sandhiya class'
Dr.Sandhiya Ravi
 

What's hot (20)

Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
Progr3
Progr3Progr3
Progr3
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
program in c
program in cprogram in c
program in c
 
C programs
C programsC programs
C programs
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
The solution manual of c by robin
The solution manual of c by robinThe solution manual of c by robin
The solution manual of c by robin
 
C faq pdf
C faq pdfC faq pdf
C faq pdf
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1
 
week-3x
week-3xweek-3x
week-3x
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
 
Examples sandhiya class'
Examples sandhiya class'Examples sandhiya class'
Examples sandhiya class'
 

Similar to Najmul

C file
C fileC file
C lab
C labC lab
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
Sazzad Hossain, ITP, MBA, CSCA™
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
KavyaSharma65
 
C basics
C basicsC basics
C basicsMSc CST
 
C programms
C programmsC programms
C programms
Mukund Gandrakota
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
Ashutoshprasad27
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
Ashutoshprasad27
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
ArghodeepPaul
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
C programs
C programsC programs
C programs
Vikram Nandini
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
RAJWANT KAUR
 
Programming in C Lab
Programming in C LabProgramming in C Lab
Programming in C Lab
Neil Mathew
 
C programming
C programmingC programming
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
Animesh Chaturvedi
 
Simple C programs
Simple C programsSimple C programs
Simple C programs
ab11cs001
 
Numerical analysis
Numerical analysisNumerical analysis
Numerical analysisVishal Singh
 

Similar to Najmul (20)

C file
C fileC file
C file
 
C lab
C labC lab
C lab
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 
C basics
C basicsC basics
C basics
 
C programms
C programmsC programms
C programms
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
 
Common problems solving using c
Common problems solving using cCommon problems solving using c
Common problems solving using c
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
C programs
C programsC programs
C programs
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
Programming in C Lab
Programming in C LabProgramming in C Lab
Programming in C Lab
 
C programming
C programmingC programming
C programming
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
Simple C programs
Simple C programsSimple C programs
Simple C programs
 
Numerical analysis
Numerical analysisNumerical analysis
Numerical analysis
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 

Najmul

  • 1. Md. Najmul Hassan ID: 171-15-1399 Sec: PC-G
  • 2. Declare a variable named num and assign the value 100 to this variable. Display “The value is 100” int main() { int num; num = 100; printf("The value is %dn", num); return 0; }
  • 3. Write a C program that will take an integer, a float and a character from keyboard and also display these inputs. #include <stdio.h> int main() { int a; float b; char ch; printf("Enter the Character:....n"); scanf("%c", &ch); printf("Enter the Integer:....n"); scanf("%d", &a); printf("Enter the float:....n"); scanf("%llf", &b); printf("nCharacter = %cn", ch); printf("Integer = %dn", a); printf("Float = %llfn", b); }
  • 4. Write a C program that will take two numbers and display the Average of these numbers #include <stdio.h> int main() { double a, b, ave; printf("Enter the two numbers for find their average:....n"); scanf("%lf %lf", &a, &b); ave = ((a+b)/2.0); printf("Average is %.1lfn", ave); return 0; }
  • 5. Write a C program to convert Celsius to Fahrenheit. [Formula is: F= (9C/5) + 32]. #include <stdio.h> int main() { float celsius, fahrenheit; printf("Enter temperature in Celsius: "); scanf("%f", &celsius); fahrenheit = ((celsius * 9)/5) + 32; printf("n%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit); return 0; }
  • 6. Write a program that will display the area of a rectangle. Take two inputs for length and width of the rectangle from the keyboard. #include <stdio.h> int main() { double a, b, c; printf("Enter the length and width:...n"); scanf("%lf %lf", &a, &b); c = a*b; printf("The rectangle is %.1lfn", c); return 0; }
  • 7. Write a program that will display the area of a Triangle. Take two inputs for base and height of the Triangle from the keyboard #include <stdio.h> int main() { double a, b, c; printf("Enter the base and height for find the area of triangle:......n"); scanf("%lf %lf", &a, &b); c = 0.5 * a * b; printf("The area of triangle is %.lfn", c); return 0; }
  • 8. Write a program that computes the number of seconds in a year #include <stdio.h> int main() { int a, b; printf("Enter the number:....n"); scanf("%d", &a); b = a / 365; printf("%d yearn", b); return 0; }
  • 9. Swapping of two numbers using C #include <stdio.h> int main() { int a, b, c=0; printf("Enter two number:....n"); scanf("%d %d", &a, &b); c=a; a=b; b=c; printf("The numbers are %d and %dn", a, b); return 0; }
  • 10. Write a C program that will take two numbers, first one for a number, second one for the power and display the power value of that number. #include <stdio.h> int main() { int base, power; long long total = 1; int i; printf("Enter base: "); scanf("%d", &base); printf("Enter power: "); scanf("%d", &power); for(i=1; i<=power; i++) { total = total * base; } printf("n%d ^ %d = %lld", base, power, total); return 0; }
  • 11. Write a C program that will take a number and displays the square root of number. #include <stdio.h> #include <math.h> int main() { double num, result; printf("Enter the number:....n"); scanf("%lf", &num); result = sqrt(num); printf("%lf number square root is %.1lfn", num, result); return 0; }
  • 12. Write a C program that displays from 1 to 100. #include <stdio.h> int main() { int i; for(i=1; i<=100; i++) { printf("%d, ", i); } return 0; }
  • 13. Write a C program that displays from 100 to 1. #include <stdio.h> int main() { int i; for(i=100; i>=1; i--) { printf("%d ,", i); } return 0; }
  • 14. Write a C program that displays the even/odd number from 1 to 100. #include <stdio.h> int main() { int odd, even, i; for(i=100; i>=1; i--) { if(i%2==0) { printf("%d is a even numbern", i); } else { printf("%d is a odd numbern", i); } } return 0; }
  • 15. Write a C program that will take an integer number and display it “EVEN” or “ODD”. #include <stdio.h> int main() { int num, even, odd; printf("Enter the number:...n"); scanf("%d", &num); if(num % 2 ==0 ) { printf("%d number is a even numbern", num); } else { printf("%d number is a odd numbern", num); } return 0; }
  • 16. Write a C program that will take a year. If its leap year then display “YES” or otherwise “NO”. #include <stdio.h> int main() { int year; printf("Enter year : "); scanf("%d", &year); if(((year%4 == 0) && (year%100 !=0)) || (year%400==0)) { printf("YESn"); } else { printf("NOn"); } return 0; }
  • 17. Write a C program that will take an integer number and display “POSITIVE” or “NEGATIVE". #include <stdio.h> int main() { int num; printf("Enter the number:....n"); scanf("%d", &num); if(num>0) { printf("POSITIVEn"); } else { printf("NEGATIVEn"); } return 0; }
  • 18. Write a C program that will take three integer numbers and display the small number. #include <stdio.h> int main() { int a, b, c; printf("Enter the numbers:.....n"); scanf("%d %d %d", &a, &b, &c); if(a<b) { if(a<c) { printf("%d is the small numbern", a); } else { printf("%d is the small numbern", c); } } else if(b<a) { if(b<c) { printf("%d is the small numbern", b); } else { printf("%d is the small numbern", c); } } return 0; }
  • 19. Write a C program that will take three integer numbers and display the middle number #include <stdio.h> int main() { int a, b, c; printf("Enter the numbers:....n"); scanf("%d %d %d", &a, &b, &c); if(a>b) { if(a<c) { printf("%d is the middle numbern", a); } else { printf("%d is the middle numbern", c); } } else if(b>a) { if(b<c) { printf("%d is the middle numbern", b); } else { printf("%d is the middle numbern", c); } } return 0; }
  • 20. Write a C program that will take three integer numbers and display the large number. #include <stdio.h> int main() { int a, b, c; printf("Enter the numbers:....n"); scanf("%d %d %d", &a, &b, &c); if(a>b) { if(a>c) { printf("%d is the large numbern", a); } else { printf("%d is the large numbern", c); } } else if(b>a) { if(b>c) { printf("%d is the large numbern", b); } else { printf("%d is the large numbern", c); } } return 0; }
  • 21. Write a C program that will take an age and if age less than 10 then display Minor. If the age between 11 to 19 then display “Teen”, If the age between 20 to 39 then display “Young”, If the age between 40 to 49 then display “Adult” otherwise “Old”. #include <stdio.h> int main() { int a; printf("Enter the age:.....n"); scanf("%d", &a); if(a<10) { printf("Minorn"); } else if(a>=11 && a<=19) { printf("Teenn"); } else if(a>=20 && a<=39) { printf("Youngn"); } else if(a>=40 && a<=49) { printf("Adultn"); } else { printf("Oldn"); } return 0; }
  • 22. Write a C program that will take a number and if the number is less than 40 then display “Fail”. If the number is between 40 to 49 then display “D”, if the number is between 50 to 59 then display “C”. If the number is between 60 to 69 then display “B”, if the number is between 70 to 79 then display “A”, if the number is between 80 to 100 then display “A+” #include <stdio.h> int main() { int a; printf("Enter the numbern"); scanf("%d", &a); if(a>=40 && a<=49) { printf("Dn"); } else if(a>=50 && a<=59) { printf("Cn"); } else if(a>=60 && a<=69) { printf("Bn"); } else if(a>=70 && a<=79) { printf("An"); } else if(a>=80 && a<=100) { printf("A+n"); } else{ printf("Failn"); } return 0; }
  • 23. Thank You Sir I am sorry that I couldn’t able to do rest the C program. If you can solve those in our class it will be great help to us.