INFOSYS EXAM SOLUTIONS
رفتن به کانال در Telegram
🎖️Main Channel: @PlacementStudio 👉Stop fearing for exams 📝📃 👉 @Ramhelper is here to help you all at lowest cost possible.👨💻👩💻 👉Chances of getting qualified = 100% ✅✅ 👉Effort from our side = 💯 🎖️Main Channel: @PlacementStudio
نمایش بیشتر2 141
مشترکین
+124 ساعت
-67 روز
-3630 روز
آرشیو پست ها
#include <stdio.h>
int main()
{
int blank_char, tab_char, new_line;
blank_char = 0;
tab_char = 0;
new_line = 0;
int c;
printf("Number of blanks, tabs, and newlines:\n");
printf("Input few words/tab/newlines\n");
for (; (c = getchar()) != EOF;)
{
if ( c == ' ' ){
++blank_char;
}
if ( c == '\t' ){
++tab_char;
}
if ( c == '\n' ){
++new_line;
}
}
printf("blank=%d,tab=%d,newline=%d\n",blank_char,tab_char,new_line);
}
C++
Find number of empty fields in a record Code
#include <stdio.h>
int main()
{
int blank_char, tab_char, new_line;
blank_char = 0;
tab_char = 0;
new_line = 0;
int c;
printf("Number of blanks, tabs, and newlines:\n");
printf("Input few words/tab/newlines\n");
for (; (c = getchar()) != EOF;)
{
if ( c == ' ' ){
++blank_char;
}
if ( c == '\t' ){
++tab_char;
}
if ( c == '\n' ){
++new_line;
}
}
printf("blank=%d,tab=%d,newline=%d\n",blank_char,tab_char,new_line);
}
C++
Find number of empty fields in a record Code
Who need help in tomorrow Accenture exam.
Share your friends.
I will share answers in this group
class GFG{
// Function to return the maximum
// water that can be stored
public static int maxWater(int[] arr, int n)
{
// To store the maximum water
// that can be stored
int res = 0;
// For every element of the array
// except first and last element
for(int i = 1; i < n - 1; i++)
{
// Find maximum element on its left
int left = arr[i];
for(int j = 0; j < i; j++)
{
left = Math.max(left, arr[j]);
}
// Find maximum element on its right
int right = arr[i];
for(int j = i + 1; j < n; j++)
{
right = Math.max(right, arr[j]);
}
// Update maximum water value
res += Math.min(left, right) - arr[i];
}
return res;
}
// Driver code
public static void main(String[] args)
{
int[] arr = { 0, 1, 0, 2, 1, 0,
1, 3, 2, 1, 2, 1 };
int n = arr.length;
System.out.print(maxWater(arr,n));
}
}
Java
Rainwater Preservation
