convert c program to c++ online
#include
using namespace std;
int main()
{
int input,count=0;
scanf("%d",&input);
for (int i=1; i<=input; i++)
{
for (int j=1; j<=i; j++)
{
if (i%j==0) count++;
}
printf("%d ",count);
count = 0;
}
}
convert c program to c++ online
#include < stdio.h>
#include
void main()
{
int f[50], i, st, len, j, c, k, count = 0;
clrscr();
for(i=0;i<50;i++)
f[i]=0;
printf("Files Allocated are : \n");
x: count=0;
printf(“Enter starting block and length of files: ”);
scanf("%d%d", &st,&len);
for(k=st;k<(st+len);k++)
if(f[k]==0)
count++;
if(len==count)
{
for(j=st;j<(st+len);j++)
if(f[j]==0)
{
f[j]=1;
printf("%d\t%d\n",j,f[j]);
}
if(j!=(st+len-1))
printf(” The file is allocated to disk\n");
}
else
printf(” The file is not allocated \n");
printf("Do you want to enter more file(Yes - 1/No - 0)");
scanf("%d", &c);
if(c==1)
goto x;
else
exit();
getch();
}
convert c program to c++ online
// C code stored in geeks.c file
#include
// global string
char s[] = "GeeksforGeeks";
// Driver Code
int main()
{
// Declaring variables
int a = 2000, b =17;
// Printing statement
printf("%s %d \n", s, a+b);
}
convert c program to c++ online
#include
int main(){
int i; char ch;
for( i = 1, ch = 'A'; i < 27 ; i++, ch++ )
{
printf("%d%c ", i,ch);
}
return 0;
}
convert c program to c++ online
#include
int main(void) {
printf("The quick brown fox \n jumps\n Over a lazy dog");
return 0;
}
convert c program to c++ online
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{
int i;
unsigned char toSend[102],mac[6];
struct sockaddr_in udpClient, udpServer;
int broadcast = 1 ;
convert c program to c++ online
#include
#include
#include
int main()
{
int g, s, a, r, w;
char response[5];
g = 10.00;
a = 2.00;
s = 15.00;
r = g + a + s;
w = g + a;
printf("This is your firs-class mail. Do you want special delivery? \n Enter Y or N: ");
scanf("%s", response);
if (response == "Y"){
printf("Your cost is %d", r);
}
else (response == "N");{
printf("Your cost is %d", w);
}
return 0;
}
convert c program to c++ online
#include
void main(void)
{
float cm, inches;
printf("Enter a length in cm : ");
scanf("%f",&cm);
inches = cm / 2.54;
printf("Length in inches is %f \n", inches);
}
convert c program to c++ online
#include
int main(void) {
int t;
scanf("%d",&t);
while(t--)
{
int p;
scanf("%d",&p);
printf("%d\n",p/2+1);
}
return 0;
}
convert c program to c++ online
#include
int main(){
int i; char ch;
for( i = 1, ch = 'A'; i < 27 ; i++, ch++ )
{
printf("%d%c ", i,ch);
}
return 0;
}
|