Category: 2nd Semester
C programming old paper solution
SAQ 2012 2013 2014 2015 2016 2017 2018 MP 2018 2019 makeup 2019 MP 2021 MP 2021
Continue Readingsome programming
1.Write a program that prints Hello World! on screen.
1 2 3 4 5 6 |
#include <stdio.h> int main() { printf("Hello World!"); return 0; } |
2. Sum of two integers
1 2 3 4 5 6 7 8 9 10 11 12 |
#include <stdio.h> int main() { int num1, num2, sum; printf("Enter first number :"); scanf("%d", &num1); printf("Enter second number :"); scanf("%d", &num2); sum = num1 + num2; printf("sum of two numbers is %d", sum); return 0; } |
3. Celsius to Farenheit conversion
1 2 3 4 5 6 7 8 9 10 11 |
#include <stdio.h> int main() { float celsius, fahrenheit; printf("Enter the temperature in celcius :"); scanf("%f", &celsius); /*Converting celcius to fahrenheit */ fahrenheit = 9.0 / 5 * celsius + 32; printf("Temperature in fahrenheit : %0.2f", fahrenheit); return 0; } |
4. Simple interest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <stdio.h> int main() { float principle, rate, time, simple_interest; printf("Enter the principle :"); scanf("%f", &principle); printf("Enter the rate :"); scanf("%f", &rate); printf("Enter the time :"); scanf("%f", &time); simple_interest = principle * rate * time / 100; printf("Simple interest is %0.2f", simple_interest); return 0; } |
5. Print ASCII value
1 2 3 4 5 6 7 8 9 |
#include <stdio.h> int main() { char letter; printf("Enter a character :"); scanf("%c", &letter); printf("ASCII value of %c is %d.", letter, letter); return 0; } |
6. Swapping of two numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <stdio.h> int main() { int num1, num2, temp; printf("Enter first number :"); scanf("%d", &num1); printf("Enter second number :"); scanf("%d", &num2); temp = num1; num1 = num2; num2 = temp; printf("After swapping, first is %d and second is %d.", num1, num2); return 0; } |
7. Area and circumference of Circle
1 2 3 4 5 6 7 8 9 10 11 |
#include <stdio.h> int main() { float radius, area, circumference; printf("Enter the radius of the circle :"); scanf("%f", &radius); area = 3.14 * radius * radius; circumference = 2 * 3.14 * radius; printf("\nThe area of the circle is %0.2f", area); printf("\nThe circumference of the circle is %0.2f", circumference); return 0; |
8.Area and circumference of Rectangle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <stdio.h> int main() { int length, width, area, circumference; printf("Enter the length of the rectangle :"); scanf("%d", &length); printf("Enter the width of the rectangle :"); scanf("%d", &width); area = length * width; circumference = 2 *(length + width); printf("\nThe area of the rectangle is %d.", area); printf("\nThe circumference of the rectangle is %d.", circumference); return 0; } |
9. Area of Triangle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include <stdio.h> #include <math.h> int main() { float a, b, c, s, area; printf("Enter the length of side 1 :"); scanf("%f", &a); printf("Enter the length of side 2 :"); scanf("%f", &b); printf("Enter the length of side 3 :"); scanf("%f", &c); s = (a + b + c) / 2; area = sqrt(s*(s - a)*(s - b)*(s - c)); printf("\nThe area of the triangle is %0.2f", area); return 0; } |
[…]
Continue ReadingDCCN || old Paper Solution
SAQ SNQ 2013 2014 2015 2016 2017 2018 MP 2018 2019 makeup 2019 2021 MP 2021
Continue Readingc programming Chapter wise
<hr/ Chapter 1 From which function C program starts? 2017 Ans:The execution of C program always stars from main () function. This is reason every C program has at least one function called main (). How to Declare and Use Constants in the C Language.year 2012 chapter 1 constants are declared using the C language […]
Continue ReadingUnit 2: Basic Concepts in Sociology
Copy and paste this code on your site. Copy and paste this code on your site. Copy and paste this code on your site. Copy and paste this code on your site. Copy and paste this code on your site. Copy and paste this code on your site. Copy and paste this code on your […]
Continue Reading