Easy Coding

Easy Coding

Share

To teach people about the world of the technology

Write a program to accept marks of five subjects from the user and calculate their average. 13/11/2021

void main() { int mark1 , mark2 , mark3 , mark4 , mark5 , total; float average; printf ( "\nEnter marks of 1st Subject : " ); scanf ( "%d" , &mark1 ); printf ( "\nEnter marks of 2nd Subject : " ); scanf ( "%d" , &mark2 ); printf ( "\nEnter marks of 3rd Subject : " ); …...

Write a program to accept marks of five subjects from the user and calculate their average. void main() { int mark1 , mark2 , mark3 , mark4 , mark5 , total; float average; printf ( “ Enter marks of 1st Subject : ” ); scanf ( “%d” , &mar…

Write a program that reads two numbers and finds the sum of the product of digits of the number.If Numbers are 224 and 37 then the Answer is23+27+23+27+43+47=80 13/11/2021

void main() { int num1 , num2 , temp1 , temp2 , rem1 , rem2 , sum=0; printf ( "\nEnter 1st Number : " ); scanf ( "%d" , &num1 ); printf ( "\nEnter 2nd Number : " ); scanf ( "%d" , &num2 ); temp1 = num1; while ( temp1 > 0 ) { rem1 = temp1 % 10; …...

Write a program that reads two numbers and finds the sum of the product of digits of the number.If Numbers are 224 and 37 then the Answer is23+27+23+27+43+47=80 void main() { int num1 , num2 , temp1 , temp2 , rem1 , rem2 , sum=0; printf ( “ Enter 1st Number : ” ); scanf ( “%d” , &num1 ); printf ( “…

Write a script to create 100 folders inside data dir and inside each folder create 100 files. Each folder name should be dir1, dir2, dir3, dir4…..etc. and file name will be 1.txt,2.txt and etc. 01/10/2021

#!/bin/bash for i in {1..100} do mkdir data/dir$i for j in {1..100} do touch data/dir$i/$j.txt done done echo "Directories and Files are created successfully." Output: Directories and Files are created successfully.

Write a script to create 100 folders inside data dir and inside each folder create 100 files. Each folder name should be dir1, dir2, dir3, dir4…..etc. and file name will be 1.txt,2.txt and etc. #!/bin/bash for i in {1..100} do mkdir data/dir$i for j in {1..100} do touch data/dir$i/$j.txt done done echo “Directories and Files are created successfully.” Output: Directories and F…

Write a shell script to implement the menu driven calculator using function and case. 27/09/2021

#!/bin/bash add(){echo $(( $1 + $2 ))} subtract(){echo $(( $1 - $2 ))} multiply(){echo $(( $1 * $2 ))} divide(){echo $(( $1 / $2 ))} mod(){echo $(( $1 % $2 ))} while true;do echo "What do you want?"echo "1. Addition"echo "2. Subtraction"...

Write a shell script to implement the menu driven calculator using function and case. #!/bin/bash add(){echo $(( $1 + $2 ))} subtract(){echo $(( $1 – $2 ))} multiply(){echo $(( $1 * $2 ))} divide(){echo $(( $1 / $2 ))} mod(){echo $(( $1 % $2 ))} while true;do echo “What …

Write a script which take input from user and calculate the addition 25/09/2021

read –p “Enter first number : ” num1 read –p “Enter second number : ” num2 echo “$num1 + $num2 = $(( num1 + num2 ))” Output: Enter first number : 5 Enter second number : 6 5 + 6 = 11

Write a script which take input from user and calculate the addition read –p “Enter first number : ” num1 read –p “Enter second number : ” num2 echo “$num1 + $num2 = $(( num1 + num2 ))” Output: Enter first number : 5 Enter second number : 6 5 + 6 = 11…

Modulus of two float numbers 25/09/2021

void main() { float num1 , num2 , res; printf ( "\nEnter 1st Number : " ); scanf ( "%f" , &num1 ); printf ( "\nEnter 2nd Number : " ); scanf ( "%f" , &num2 ); res = fmod (num1 , num2); printf ( "\n%.2f mod %.2f = %.2f" , num1 , num2 , res ); } Output: Enter 1st Number : 5Enter 2nd Number : 25.00 mod 2.00 = 1.00

Modulus of two float numbers void main() { float num1 , num2 , res; printf ( “ Enter 1st Number : ” ); scanf ( “%f” , &num1 ); printf ( “ Enter…

Write a C program to find out given character is vowel or not. 14/09/2021

void main() { char ch; printf ( "\nEnter a character : " ); scanf ( "%c" , &ch ); if ( ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U' || ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') …...

Write a C program to find out given character is vowel or not. void main() { char ch; printf ( “ Enter a character : ” ); scanf ( “%c” , &ch ); if ( ch == ‘A’ || ch == ‘E’ || ch == & #…

Check whether a number is positive, negative or zero using a switch statement. 13/09/2021

void main() { int num; printf ( "\nEnter a Number : " ); scanf ( "%d" , &num ); switch ( num > 0 ) { case 1: printf ( "\n%d is a positive number." , num ); break; case 0: switch ( num < 0 ) { case 1: printf ( "\n%d is a negative number." , num ); …...

Check whether a number is positive, negative or zero using a switch statement. void main() { int num; printf ( “ Enter a Number : ” ); scanf ( “%d” , &num ); switch ( num > 0 ) { case 1: printf ( “ %d is a positiv…

Check that a given number is a prime number or not. 13/09/2021

include void main(){int num , i , FactorCount=0;printf ( "\nEnter a Number : " );scanf ( "%d" , &num );for ( i = 1 ; i

Check that a given number is a prime number or not. include void main(){int num , i , FactorCount=0;printf ( “ Enter a Number : ” );scanf ( “%d” , &num );for ( i = 1 ; i

Write a Menu Driven Calculator program that will perform following operations-Sum-Substraction-Division-Multiplication-Mod 12/09/2021

void main() { int num1 , num2 , res , ch='S'; printf ( "\nWhat do you want?" "\n1. Addition (Press A)" "\n2. Subtraction (Press S)" "\n3. Multiplication (Press M)" "\n4. Division (Press D)" "\n5. Modulation (Press X)" "\n Your choice : " ); scanf ( "%c" , &ch ); printf ( "\nEnter 1st Number : " ); scanf ( "%d" , &num1 ); …...

Write a Menu Driven Calculator program that will perform following operations-Sum-Substraction-Division-Multiplication-Mod void main() { int num1 , num2 , res , ch=’S’; printf ( “ What do you want?” “ 1. Addition (Press A)” “ 2. Subtraction (Press S)&…

Example of conditional statement (switch..case) 28/08/2021

void main() { int ch=0, num1, num2; //to store the numbers and their result clrscr(); //to clear the output screen printf ( "\nEnter the 1st number : "); scanf ( "%d" , &num1 ); printf ( "\nEnter the 2nd number : "); scanf ( "%d" , &num2 ); printf ( "\nWhat do you want to do?" ); printf ( "\n1.Addition 2.Subtraction" );...

Example of conditional statement (switch..case) void main() { int ch=0, num1, num2; //to store the numbers and their result clrscr(); //to clear the output screen printf ( “ Enter the 1st nu…

Example of conditional statements (if… else statement) 21/08/2021

void main() { int num1, num2; //to store the numbers and their result clrscr(); //to clear the output screen printf ( "\nEnter the 1st number: "); scanf ( "%d" , &num1 ); printf ( "\nEnter the 2nd number: "); scanf ( "%d" , &num2 ); if ( num1 < num2 ) //to check the condition printf ( "\n%d is smaller than %d" , num1 , num2 );...

Example of conditional statements (if… else statement) void main() { int num1, num2; //to store the numbers and their result clrscr(); //to clear the output screen printf ( “ Enter the 1st number: …

Want your school to be the top-listed School/college in Patna?

Click here to claim your Sponsored Listing.

Location

Address


City Chowk
Patna
800008