J

@jayanth_balamurugan_R

Take values of length and breadth of a rectangle from user and check if it is square or not.

Python
2 years ago
length=int(input("enter the length of the rectangle:\n ")) breadth=int(input("enter the breadth of the rectangle: \n")) if (length==breadth): print("it is a square") else: print("it is a rectangle")

A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years.

Python
2 years ago
yos=int(input("enter your year of service: \n")) if (yos>5): salary=int(input("enter your salary: \n")) bonus=salary*0.05 print(f"your bonus amount is {bonus}") else: print("sorry, you are not applicable for getting a bonus")

swapping of numbers

Python
2 years ago
a=input("enter the value of a\n") print(a) b=input("enter the value of b\n") print(b) temp=a a=b b=temp print("value of a after swapping:") print(a) print("value of b after swapping:")

Write a program in C to count the total number of words in a string

C
2 years ago
#include <stdio.h> #include <string.h> int main(){ char name[90]; int i=0; int len=0, word=0; printf("enter the sentence:\n "); fgets(name,sizeof(name),stdin); len=strlen(name);

Write a program in C to print individual characters of a string in reverse order.

C
2 years ago
#include <stdio.h> #include <string.h> int main() { char name[90]; int i=0, len; printf("enter your name: "); fgets(name,sizeof(name),stdin); len=strlen(name); for (i=len;i>=0;i--){

Write a program in C to input a string and print it.

C
2 years ago
#include <stdio.h> #include <string.h> int main() { char name[20]; printf("enter your name: "); fgets(name,sizeof(name),stdin); printf("\nyour name is: %s",name); return 0; }

evaluation 2 [2 b]

C
2 years ago
#include <stdio.h> #include <string.h> struct Employee{ char name[90]; int age; char department[90]; char city[90]; };

evaluation 2

C
2 years ago
#include <stdio.h> #include <string.h> struct Employee{ char name[90]; int age; char department[90]; char city[90]; }; int main() {

evaluation 2

C
2 years ago
#include <stdio.h> #include <string.h> struct Employee{ char name[90]; int age; double salary; char department[90]; float YOS; };

2nd largest element

C
2 years ago
#include <stdio.h> void main() { int arr1[50], n, i, j = 0, lrg, lrg2nd; printf("Input the size of the array : "); scanf("%d", &n); printf("\nInput %d elements in the array :\n", n);

array

C
2 years ago
#include <stdio.h> int main() { int arr1[90]; int arr2[90]; int sumarr[90]; int i=0; for (i=0;i<5;i++){ scanf("%d",&arr1[i]); }

addition of two matrices

C
2 years ago
#include <stdio.h> int main() { int a[3][3], b[3][3], c[3][3]; int i=0; int j=0; for (i=0;i<3;i++){ for (j=0;j<3;j++){ scanf("%d",&a[i][j]); }

transpose of a matrix

C
2 years ago
#include <stdio.h> int main() { int arr[2][3]; int i=0; int j=0; for (i=0;i<2;i++){ for (j=0;j<3;j++){ scanf("%d",&arr[i][j]); }

matrix

C
2 years ago
#include <stdio.h> int main() { int arr[10][10]; int i=0,j=0; for (i=0;i<5;i++){ for (j=0;j<5;j++){ scanf("%d",&arr[i][j]); } }

no. of even and odd numbers in an array

C
2 years ago
#include <stdio.h> int main() { int arr[10]; int i=0,even=0,odd=0; printf("enter the elements of the array: "); for (i=0;i<10;i++){ scanf("%d",&arr[i]); if (arr[i]%2==0){ even++;

sum and avg of an array

C
2 years ago
#include <stdio.h> int main() { int arr[9]; int i,sum=0; float avg; printf("\nenter the elements of the array: "); for (i=0;i<5;i++){ scanf("%d",&arr[i]); }

functions3

C
2 years ago
#include <stdio.h> int swap(int*p,int*q); int main() { int a,b; printf("enter two numbers: "); scanf("%d %d",&a,&b); printf("before swapping_ a=%d and b=%d",a,b); swap(&a,&b); printf("\nafter swapping_ a=%d and b=%d",a,b); return 0;

function 2 (square of a number)

C
2 years ago
#include <stdio.h> float sqnum(); int main() { sqnum(); return 0; } float sqnum(){ int a; float square;

functions 1

C
2 years ago
#include <stdio.h> float fun(); int main() { int a=5; int b=6; int sum=0; sum=a+b; fun(); printf("\nsum=%d",sum); return 0;

call by value

C
2 years ago
#include <stdio.h> int fun(); int main() { int a,b; a=5; b=7; fun(a,b); printf ("\na=%d & b=%d",a,b); }