Expected Output:: 1. Write A C Program To Print Your Name, Date of Birth. and Mobile Number
Expected Output:: 1. Write A C Program To Print Your Name, Date of Birth. and Mobile Number
Expected Output:
Name : Alexandra Abramov
DOB : July 14, 1975
Mobile : 99-9999999999
Cod:
#include <stdio.h>
int main(void){
printf("Mobile : 99-9999999999\n");
return 0;
Expected Output:
We are using C18!
#include <stdio.h>
int main()
#if __STDC_VERSION__>=201710L
#elif __STDC_VERSION__>=201112L
#elif __STDC_VERSION__>=99409L
#endif
return 0;
3. Write a C program to print a block F using hash (#), where the F has a height
of six characters and width of five and four characters. And also to print a big 'C'.
Expected Output:
#include <stdio.h>
int main()
{
printf("######\n");
printf("#\n");
printf("#\n");
printf("#####\n");
printf("#\n");
printf("#\n");
printf("#\n");
return(0);
}
######
#
#
#####
#
#
#
#include <stdio.h>
int main()
{
printf(" ######\n");
printf(" ## ##\n");
printf(" #\n");
printf(" #\n");
printf(" #\n");
printf(" #\n");
printf(" #\n");
printf(" ## ##\n");
printf(" ######\n");
return(0);
}
######
## ##
#
#
#
#
#
## ##
######
int main()
printf ("The reverse of %c%c%c is %c%c%c" ,char1, char2, char3, char3, char2, char1);
return 0;
#include <stdio.h>
int main()
int height = 7;
int Perimeter=(2*height+2*width);
int area=height*width;
return 0;
}
6. Write a C program to compute the perimeter and area of a circle with a radius
of 6 inches.
Expected Output:
Perimeter of the Circle = 37.680000 inches
Area of the Circle = 113.040001 square inches
#include <stdio.h>
int main()
int radius=6;
float perimeter=2*3.14*radius;
float area=3.14*radius*radius;
return 0;
#include <stdio.h>
int main()
{
long ax = 1234567890;
short s = 4043;
float x = 2.13459;
double dx = 1.1415927;
char c = 'W';
return 0;
}
8. Write a C program to convert specified days into years, weeks and days.
Note: Ignore leap year.
Test Data :
Number of days : 1329
Expected Output :
Years: 3
Weeks: 33
Days: 3
#include <stdio.h>
int main()
int days;
int weeks;
int years;
days=1329;
years=days/365;
weeks=(days % 365)/7;
printf("Years:%d\n", years);
return 0;
}
9. Write a C program that accepts two integers from the user and calculate the
sum of the two integers.
Test Data :
Input the first integer: 25
Input the second integer: 38
Expected Output:
Sum of the above two integers = 63
#include <stdio.h>
int main()
int a, b, sum;
sum=a+b;
return 0;
10. Write a C program that accepts two integers from the user and calculate the
product of the two integers.
Test Data :
Input the first integer: 25
Input the second integer: 15
Expected Output:
Product of the above two integers = 375
#include <stdio.h>
int main()
int a, b, product;
product=a*b;
return 0;
11. Write a C program that accepts two item’s weight (floating points' values )
and number of purchase (floating points' values) and calculate the average value
of the items.
Test Data :
Weight - Item1: 15
No. of item1: 5
Weight - Item2: 25
No. of item2: 4
Expected Output:
Average Value = 19.444444