Codeforces 546A Soldier and Bananas solution in C++

Codeforces 546A Soldier and Bananas solution in C++

Codeforces 546A. Soldier and Bananas Question A. Soldier and Bananas A soldier wants to buy w bananas in the shop. He has to pay k dollars for the first banana, 2k dollars for the second one and so on (in other words, he has to pay i·k dollars for the i-th banana). He has n dollars. How many dollars does he have to borrow from his … Read more

2D Arrays in C || C Multidimensional Arrays

2D Arrays in C

Understanding 2D Arrays in C Multidimensional arrays in C are those that have more than one dimension. They can be compared to a table with columns and rows. In C, a multidimensional array can be declared using the following syntax: data_type array_name[row_size][column_size]; For instance, we may write the following to declare a 2D array with … Read more

How to start programming?

How to start programming?

How to start programming? Starting to learn to program can seem daunting, but with the right approach, it can be a fun and rewarding experience. Here are some steps to help you get started: Remember that programming is a skill that takes time and practice to develop. Stay motivated, be persistent, and enjoy the learning … Read more

How do you use Scanf to enter integers into the array in C?

How do you use Scanf to enter integers into the array in C?

How do you use Scanf to enter integers into the array in C? #include <stdio.h> int main() { int i, n; printf(“Enter the number of integers you want to enter: “); scanf(“%d”, &n); int arr[n]; printf(“Enter %d integers: “, n); for (i = 0; i < n; i++) { scanf(“%d”, &arr[i]); } printf(“You entered: “); … Read more

Codeforces 118A. String Task solution in C/CPP

118A. String Task problem link Codeforces 118A. String Task solution in C #include<stdio.h>int main() { int i; char s[101]; gets(s); strlwr(s); for(i=0;s[i]!=’\0′;i++) { if(s[i]==’a’||s[i]==’e’||s[i]==’i’||s[i]==’o’||s[i]==’u’||s[i]==’A’||s[i]==’E’||s[i]==’O’||s[i]==’I’||s[i]==’U’||s[i]==’y’||s[i]==’Y’) { continue; } else { printf(“.%c”,s[i]); } } printf(“\n”); return 0; } Codeforces 118A. String Task solution in CPP #include <iostream> #include <cstring> #include <cctype> using namespace std; int main() { … Read more

Beecrowd 1042 Simple Sort Solution in C,Cpp

beecrowd 1042

Beecrowd 1042 Simple Sort Solution Question Solution in C #include<stdio.h> int main() { int a,b,c,temp,x,y,z; scanf(“%d%d%d”,&a,&b,&c); x=a; y=b; z=c; if(a>b){ temp=a; a=b; b=temp; } if(a>c){ temp=a; a=c; c=temp; } if(b>c){ temp=b; b=c; c=temp; } printf(“%d\n%d\n%d\n\n”,a,b,c); printf(“%d\n%d\n%d\n”,x,y,z); return 0; } Next problem solution: Beecrowd -1043 Triangle Solution in C & C++