V

@vanshu_179

Largest element

C++
3 years ago
#include <iostream> using namespace std; int main() { int i,n,arr[10]; cout<<"total elements \n"; cin>>n; cout<<"enter numbers\n"; for(i=0;i<n;i++) {

take a string from user using %c

C
3 years ago
#include <stdio.h> int main() { char str[100]; char ch; int i=0; while(ch != '\n') { scanf("%c",&ch); str[i] = ch;

string concatenation

C
3 years ago
#include <stdio.h> #include<string.h> int main() { char firststr[80]="vanshika "; char secondstr[50]="singla"; strcat(firststr,secondstr); puts(firststr); return 0; }

program that input user's name & print its length

C
3 years ago
#include <stdio.h> void printstring(char arr[]); int countlength(char arr[]); int main() { char name[100]; fgets(name,100,stdin); printf("length is:%d",countlength(name)); return 0;

string using pointers

C
3 years ago
#include <stdio.h> int main() { char *name="vanshika singla"; puts(name); name="vanshika"; puts(name); name="vanshu"; puts(name); return 0;

division of 2 matrices

C++
3 years ago
#include<iostream> using namespace std; int main() { int r,c,i,j,a[5][5],b[5][5],division[5][5]; cout<<"enter the number of rows\n"; cin>>r; cout<<"enter the number of columns\n"; cin>>c;

product of 2 matrices

C++
3 years ago
#include<iostream> using namespace std; int main() { int r,c,i,j,a[5][5],b[5][5],product[5][5]; cout<<"enter the number of rows\n"; cin>>r; cout<<"enter the number of columns\n"; cin>>c;

matrix subtraction

C++
3 years ago
#include<iostream> using namespace std; int main() { int r,c,i,j,a[5][5],b[5][5],diff[5][5]; cout<<"enter the number of rows\n"; cin>>r; cout<<"enter the number of columns\n"; cin>>c;

enter a name

C
3 years ago
#include <stdio.h> int main() { //char n; //char name[44]="vanshika"; char name[50]; //fgets(name,40,stdin); scanf("%s",name); printf("%s",name); return 0;

Reverse an array

C++
3 years ago
#include <iostream> #include <stdio.h> int countodd(int arr[], int n); void reverse(int arr[], int n); void printarr(int arr[], int n); int main() { int n; std::cin >> n;

Matrix addition

C++
3 years ago
#include<iostream> using namespace std; int main() { int r,c,a[2][2],b[2][2],sum[2][2]; cout<<"enter the no. of rows\n"; cin>>r; cout<<"enter the no. of columns\n"; cin>>c;

name

C
3 years ago
#include <stdio.h> int main() { char n; //char name[]="vanshika"; char name[50]; fgets(name,40,stdin); scanf("%s",name); printf("%s",name); return 0;

string first & lastname to store details of user & print all the characters using loop

C
3 years ago
#include <stdio.h> void string(char arr[]); int main() { char firstname[] = {'V','A','N','S','H','I','K','A','\0'}; char lastname[] = {'S','I','N','G','L','A','\0'}; string(firstname); string(lastname);

a 2d array which store the tables of 2&3

C
3 years ago
#include <stdio.h> void storetable(int arr[][10],int n,int m,int number); int main() { int tables[2][10]; storetable(tables,0,10,2); storetable(tables,1,10,3); for(int i=0;i<10;i++) {

program to store the first n fibonacci numbers in array

C
3 years ago
#include <stdio.h> int main() { int n; printf("enter n (n>2):"); scanf("%d",&n); int fib[n]; fib[0]=0; fib[1]=1;

function to reverse an array

C
3 years ago
#include <stdio.h> int countodd(int arr[], int n); void reverse(int arr[], int n); void printarr(int arr[], int n); int main() { int arr[]={1, 2, 3, 4, 5}; reverse(arr,5); printarr(arr,5);

function to count the number of odd numbers in an array

C
3 years ago
#include<stdio.h> int countodd(int arr[], int n); int main() { int arr[10]; printf("enter an arr[] \n"); for(int i=0;i<10;i++){ scanf("%d",&arr[10]); }

array to print marks of a student in 3 subjects i.e 2d array

C
3 years ago
#include <stdio.h> int main() { int marks[2][3]; marks[0][0]=78; marks[0][1]=87; marks[0][2]=98; printf("%d",marks[0][0]); return 0; }

array to print 5 values of aadhar

C
3 years ago
#include <stdio.h> int main() { int aadhar[5]; int *ptr = &aadhar [0]; for(int i=0;i<5;i++) { printf("%d index : ",i); scanf("%d",&aadhar[i]);

write a function to count the number of odd numbers in an array

C
3 years ago
#include <stdio.h> int countodd(int arr[], int n); int main() { int arr[]={1,2,3,4,5,6,7,8}; printf("%d",countodd(arr,8)); return 0; }