Contact : +88 01840-723661

|

Email : info@jakafind.com

C Programming Structure Practice

C Programming Structure Practice

 

Problem – 01 : Printing “Hello World!”.

#include <stdio.h>
int main() {
printf("Hello World!");
return 0; }

Problem – 02 : Printing two sentences on two different lines. (Using of \n)

#include <stdio.h>
int main() {
printf("Hello\nWorld!");
return 0; }

Problem – 03 : Print a line in a quotation mark (For example: “Hello World”.)

#include <stdio.h>
int main() {
printf("\"Hello World!\"");
return 0; }

Problem – 04

#include <stdio.h>
int main() {
int a=10, b;
printf("Enter a Number: ");
scanf("%d", &b);
a=10+b;
printf("Changing Value = %d\n", a);
return 0; }

Problem – 05

#include <stdio.h>
#define Pi 3.14159;
int main() {
float rad = 6, area;
area = Pi*pow(rad,2);
printf("Area = %.2f \n", area);
return 0; }

Problem – 06

#include <stdio.h>
int main() {
int a=10,b=3;
printf("Output = %d\n", a-=b);
return 0; }

Problem – 07

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 08

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 09

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 10

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 11

#include <stdio.h>
int main() {
float a, b, sum, sub, mul, dev;
printf("Enter First number: ");
scanf("%f", &a);
printf("Enter Second number: ");
scanf("%f", &b);
sum=a+b;
sub=a-b;
mul=a*b;
dev=a/b;
printf("The Two Number Addition is: %.4f\n", sum);
printf("The Two Number Substrction is: %.4f\n", sub);
printf("The Two Number Multification is: %.4f\n", mul);
printf("The Two Number Divided is: %.4f\n", dev);
return 0; }

Problem – 12

#include <stdio.h>
int main() {
float a,b,c, avr;
printf("Enter Three number: ");
scanf("%f %f %f", &a, &b, &c);
avr=(a+b+c)/3;
printf("The Floating Average Number is: %.4f\n", avr);
return 0; }

Problem – 13

#include <stdio.h>
int main() {
float lenth, breadth, area;
printf("Enter First number: ");
scanf("%f", &lenth);
printf("Enter Second number: ");
scanf("%f", &breadth);
area = lenth*breadth;
printf("The Rectangular Area is: %.4f\n", area);
return 0; }

Problem – 14

#include <stdio.h>
int main() {
float C,F;
printf("Enter Fahrenheit Value: ");
scanf("%f", &F);
C = (F-32)/1.8;
printf("The Centigrade Value : %.2f \n", C);
return 0; }

Problem – 15

#include <stdio.h>
int main() {
float distance, vulue_cm, vulue_inch, vulue_feet;
printf("Enter The Distanc Mirpur and Ashulia at Meter: ");
scanf("%f", &distance);
vulue_cm = distance*100;
vulue_inch = distance*39.37;
vulue_feet = distance*3.21;
printf("The Value at cm is: %.2f cm\n",vulue_cm );
printf("The Value at inch is: %.2f inch\n",vulue_inch );
printf("The Value at feet is: %.2f feet\n",vulue_feet );
return 0; }

Problem – 16

#include <stdio.h>
int main() {
float salary, basic_salary, house_rant,total_sarary;
printf("Enter Your Salary:  ");
scanf("%f", &salary);
basic_salary = salary*.2;
house_rant = salary*.4;
total_sarary = salary + basic_salary+house_rant;
printf("Total Salary = %f",total_sarary);
return 0; }

Problem – 17

#include <stdio.h>
int main() {
float sub1, sub2, sub3, sub4, sub5;
printf("Enter marks for Subject 1: ");
scanf("%f", &sub1);
printf("Enter marks for Subject 2: ");
scanf("%f", &sub2);
printf("Enter marks for Subject 3: ");
scanf("%f", &sub3);
printf("Enter marks for Subject 4: ");
scanf("%f", &sub4);
printf("Enter marks for Subject 5: ");
scanf("%f", &sub5);
float aggregateMarks = sub1 + sub2 + sub3 + sub4 + sub5;
float averageMarks = (float)aggregateMarks / 5;
printf("Aggregate Marks: %.2f\n", aggregateMarks);
printf("Average Marks: %.2f\n", averageMarks);
return 0; }

Problem – 18

#include <stdio.h>
int main() {
char ch;
printf("Enter any character : ");
scanf("%c", &ch);
printf("The ASCII value is : %d \n",ch);
return 0; }

Problem – 19 (Beecrowd Problem 1001)

#include <stdio.h>
int main() {
int A, B, X;
scanf("%d %d", &A,&B);
X = A + B;
printf("X = %d\n", X);
return 0;}

Problem – 20 (Beecrowd Problem 1002)

#include <stdio.h>
int main() {
double pi = 3.14159;
double R, area;
scanf("%lf", &R);
area = pi * R * R;
printf("A=%.4lf\n", area);
return 0;}

Problem – 21

#include <stdio.h>
int main() {
int a, b;
printf("Enter a Number: ");
scanf("%d", &a);
(a%2==0)? printf("Even"):printf("Odd");
return 0; }

Problem – 22

#include <stdio.h>
int main() {
int num1,num2,num3,largest;
printf("Enter Three iInteger Number: ");
scanf("%d %d %d",&num1,&num2,&num3);
largest = (num1 > num2 && num1 > num3)? num1 : (num2 > num3)? num2 : num3;
printf("The Largest number is : %d\n", largest);
return 0; }

Problem – 23

#include <stdio.h>
int main() {
char ch;
printf("Enter any character: ");
scanf("%c", &ch);
(ch>='a' && ch<='z') || (ch>='A' && ch<='Z') 
? printf("It is ALPHABET")
: printf("It is NOT ALPHABET");
return 0; }

Problem – 24

#include <stdio.h>
int main() {
float salary, bonus, commission, price, sold, total_sarary;
salary=1500.00;
printf("Enter Each Computer Price: ");
scanf("%f", &price);
printf("Enter Total Computer Sold: ");
scanf(“%f”, &sold);
bonus = price*200;
commission = price*sold*.2;
total_sarary = salary + bonus + commission;
printf("Total Salary = %f\n",total_sarary);
return 0; }

Problem – 25

#include <stdio.h>
int main () {
float a, b, price;
printf("Enter 15 item Price: ");
scanf("%f", &a);
printf("Enter 15 item Profit: ");
scanf("%f", &b);
price=(a-b)/15;
printf("Cost of Each Product Price = %.2f", price);
return 0; }

Problem – 26 (Beecrowd Problem 1007)

#include <stdio.h>
int main() {
int A, B, C, D;
int difference;
scanf("%d %d %d %d", &A, &B, &C, &D);
difference = (A * B) - (C * D);
printf("DIFERENCA = %d\n", difference);
return 0; }

Problem – 27 (Beecrowd Problem 1008)

#include <stdio.h>
int main () {
int NUMBER,hours;
float amount,SALARY;
scanf("%d %d %f", &NUMBER, &hours, &amount);
SALARY = hours * amount;
printf("NUMBER = %d\n",NUMBER);
printf("SALARY = U$ %0.2f\n", SALARY);
return 0; }

Problem – 28

#include <stdio.h>
int factorial (int n) {
if (n == 0 || n == 1)
return 1;
else
return n * factorial (n - 1); }
int main() {
int number;
printf("Enter a number to find its factorial: ");
scanf("%d", &number);
if (number < 0) {
printf("Factorial is not defined for negative numbers.\n");
} else {
int result = factorial (number);
printf("Factorial of %d is: %d\n", number, result); }
return 0; }

Problem – 29

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 30

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 31

#include <stdio.h>
int main() {
int num;
printf ("Enter an integer: ");
scanf("%d", &num);
if(num % 2 == 0)
printf("%d is an even number.", num);
else
printf("%d is a odd number.", num);
return 0; }

Problem – 32

#include <stdio.h>
int main() {
char ch;
printf("Enter any character: ");
scanf("%c", &ch);
if ((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
printf("This is an ALPHABET\n");
else 
printf("This is NOT an ALPHABET\n");
return 0; }

Problem – 33

#include <stdio.h>
int main() {
float a, b, c;
printf ("Enter three angles of any triangle: ");
scanf("%f %f %f", &a, &b, &c);
if(a+b+c==180)
printf("This is a Triangle.");
else
printf("This is not a Triangle.");
return 0; }

Problem – 34

#include<stdio.h>
int main() {
int year;
printf("Enter any year: ");
scanf("%d",&year);
if(year%400==0){
printf("It is a leap year = %d",year);
} else if(year%4==0 && year%100!=0){
printf("It is a leap year = %d",year);
} else printf("It is not a leap year");
return 0; }

Problem – 35

#include <stdio.h>
int main() {
int alif, fahmid, joy;
printf("Enter the age of Alif: ");
scanf("%d", &alif);
printf("Enter the age of Fahmid: ");
scanf("%d", &fahmid);
printf("Enter the age of Joy: ");
scanf("%d", &joy);
if (alif < fahmid && alif < joy)
printf("Alif is the youngest person.\n");
else if (fahmid < joy)
printf("Fahmid is the youngest person.\n");
else
printf("Joy is the youngest person.\n");
return 0; }

Problem – 36

#include<stdio.h>
int main(){
float c, p, b, m, co, avr_marks;
printf("Enter your chemistry marks: ");
scanf("%f", &c);
printf("Enter your physics marks: ");
scanf("%f", &p);
printf("Enter your biology marks: ");
scanf("%f", &b);
printf("Enter your mathematics marks: ");
scanf("%f", &m);
printf("Enter your computer marks: ");
scanf("%f", &co);
avr_marks = ((c+p+b+m+co)*100)/500;
if(avr_marks >=90)
printf("Grade A");
else if(avr_marks >=80)
printf("Grade B");
else if(avr_marks >=70)
printf("Grade C");
else if(avr_marks >=60)
printf("Grade D");
else if(avr_marks >=40)
printf("Grade E");
else if(avr_marks <40)
printf("Grade F");
else
printf ("Please Enter Your Subject Number.\n");
return 0; }

Problem – 37

#include <stdio.h>
int main() {
int cus;
float units, bill;
printf("Enter Customer Id Number: ");
scanf("%d",&cus);
printf("Enter Total Customer Units: ");
scanf("%f", &units);
if(units <= 200)
bill = 0.50 * units;
else if(units >= 201 && units <= 400)
bill = 100 + 0.65 * (units - 200);
else if(units >= 401 && units <= 600)
bill = 230 + 0.85 * (units - 400);
else 
bill = 390 + 1.00 * (units - 600);
printf("\n Customer Number = %d", cus);
printf("\n Units consumed  = %.2f", units);
printf("\n Bill = %.2f", bill);
return 0; }

Problem – 38

#include <stdio.h>
int main() {
char operator;
double a, b;
printf("Enter Any Opearator (+, -, *, /) : ");
scanf("%c", &operator);
printf("Enter Your First Number: ");
scanf("%lf", &a);
printf("Enter Your Second Number: ");
scanf("%lf", &b);
switch (operator){
case'+':
printf("\nAddition : %.2lf + %.2lf = %.2lf", a, b, a+b);
break;
case'-':
printf("\nSubstruction : %.2lf - %.2lf = %.2lf", a, b, a-b);
break;
case'*':
printf("\nMultification : %.2lf * %.2lf = %.2lf", a, b, a*b);
break;
case'/':
if(b==0) 
printf("\nSecond value is 0. So, The divided value is undefine");
else
printf("\nDivided : %.2lf / %.2lf = %.2lf", a, b, a/b);
break; }
return 0; }

Problem – 39

#include <stdio.h>
int main() {
int X, Y;
float price = 0;
scanf("%d %d", &X, &Y);
if (X == 1) {
price = (float) (4.00 * Y); }
else if (X == 2) {
price = (float) (4.50 * Y); }
else if (X == 3) {
price = (float) (5.00 * Y); }
else if (X == 4) {
price = (float) (2.00 * Y); }
else if (X == 5) {
price = (float) (1.50 * Y); }
printf("Total: R$ %.2f\n", price);
return 0; }

Problem – 40

#include <stdio.h> 
int main() { 
int num_a, num_b; 
scanf("%d %d", &num_a, &num_b); 
if (num_b % num_a == 0 || num_a % num_b == 0) { 
printf("Sao Multiplos\n"); 
} else { 
printf("Nao sao Multiplos\n"); }
return 0; }

Problem – 41

#include <stdio.h>
int main() {
    int i;
    for(i=2; i<=100; i=i+2) {
    printf("%d\n",i); }
return 0; }

Problem – 42

#include <stdio.h>
int main() {
int a,sum=0;
for (a =2; a<=10; a+=2) {
sum += a; }
printf("The sum of the even numbers from 1 to 10 is: %d \n", sum);
return 0; }

Problem – 43

#include <stdio.h>
int main() {
int number;
int sum = 0;
printf("Enter a five-digit number: ");
scanf("%d", &number);
if (number < 10000 || number > 99999) {
printf("Invalid input. Please enter a five-digit number.\n"); }
while (number > 0) {
sum += number % 10;
number /= 10; }
printf("The sum of the digits of the entered number is: %d\n", sum);
return 0; }

Problem – 44

#include <stdio.h>
int main( ) {
int number, reverse=0, remainder, num;
printf("Enter a 5 digit number: ");
scanf("%d", &number);
if (number < 10000 || number > 99999) {
printf("Invalid input. Please enter a five-digit number.\n"); }
num=number;
while (num>0) {
remainder=num%10;
reverse=reverse*10+remainder;
num=num/10;}
printf("Reverse number is %d \n", reverse);
if(number == reverse)
printf("Reverse number is equal to actual number.\n");
else
printf("Reverse number is not equal to actual number.\n");
return 0; }

Problem – 45

#include <stdio.h> 
int main(){
int a, b = 1, num; 
printf("Input the number : "); 
scanf("%d", &num); 
for(a = 1; a <= num; a++) 
b = b * a;
printf("The Factorial of %d is: %d\n", num, b); 
return 0; }

Problem – 46

#include <stdio.h>
int main() {
int low, high, a, b;
printf("Enter two low and high numbers: ");
scanf("%d %d", &low, &high);
printf("Prime numbers between %d and %d are: \n", low, high);
while (low < high) {
b = 0;
if (low <= 1) {
++low;
continue;}
for (a = 2; a <= low / 2; ++a) {
if (low % a == 0) {
b = 1;
break; } }
if (b == 0)
printf("%d ", low);
++low; }
return 0; }

Problem – 47

#include <stdio.h>
int main() {
int n, i, flag = 0;
printf("Enter a positive or negative integer number: ");
scanf("%d", &n);
if (n == 0 || n == 1)
flag = 1;
for (i = 2; i <= n / 2; ++i) {
if (n % i == 0) {
flag = 1;
break;}}
if (flag == 0)
printf("%d is a prime number.", n);
else
printf("%d is not a prime number.", n);
return 0;}

Problem – 48

#include <stdio.h>
int main() {
int i, n;
int t1 = 0, t2 = 1;
int nextTerm = t1 + t2;
printf("Enter the number of terms: ");
scanf("%d", &n);
printf("Fibonacci Series: %d, %d, ", t1, t2);
for (i = 3; i <= n; ++i) {
printf("%d, ", nextTerm);
t1 = t2;
t2 = nextTerm;
nextTerm = t1 + t2;}
return 0; }

Problem – 49

#include<stdio.h>
int main() {
float x;
int i,sum=0;
for(i=1;i<=6;i++){
scanf("%f",&x);
if(x>0){
sum=sum+1; } }
printf("%d valores positivos\n",sum);
return 0; }

Problem – 50

#include <stdio.h>
int main() {
int a,b;
for (a = 1; a <= 4; a++) {
for (int b = a; b >=1; b--) {
printf(" %d ", b); }
printf("\n"); }
return 0; }

Problem – 51

#include <stdio.h>
int main(){
int a[5],b;
printf("Enter 5 Numbers: ");
for(b=0;b<5;b++)
scanf("%d",&a[b]);
printf("Odd Numbers in Array are: ");
for(b=0;b<5;b++)
if(a[b]%2!=0) 
printf("%d ",a[b]);
return 0;}

Problem – 52

#include<stdio.h>
int main() {
int a[5],b,sum=0;
printf("Enter 5 even and odd number: ");
for(b=0; b<5; b++)
scanf("%d",&a[b]);
for(b=0; b<5; b++) {
if(a[b]%2==0)
sum=sum+a[b]; }
printf("Total Sum of Even values is: %d ",sum); 
return 0; }

Problem – 43

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 44

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 45

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 46

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 47

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 48

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 49

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 50

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

 

Problem – 41

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 42

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 43

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 44

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 45

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 46

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 47

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 48

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 49

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 50

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

 

Problem – 41

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 42

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 43

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 44

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 45

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 46

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 47

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 48

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 49

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 50

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

 

Problem – 41

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 42

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 43

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 44

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 45

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 46

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 47

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 48

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 49

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 50

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

 

Problem – 41

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 42

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 43

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 44

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 45

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 46

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 47

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 48

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 49

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

Problem – 50

#include <stdio.h>
int main() {
printf("Md Jakaria Nur!\n");
return 0; }

 

 

Thank You!

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *